Dominic Grimm
0e742965cc
All checks were successful
continuous-integration/drone/push Build is passing
27 lines
717 B
Docker
27 lines
717 B
Docker
FROM crystallang/crystal:latest-alpine as deps
|
|
WORKDIR /app
|
|
RUN apk add curl --no-cache
|
|
COPY ./shard.yml ./shard.lock ./
|
|
RUN shards install --production
|
|
|
|
FROM crystallang/crystal:latest-alpine as builder
|
|
ARG BUILD_ENV
|
|
WORKDIR /app
|
|
COPY --from=deps /app/shard.yml /app/shard.lock ./
|
|
COPY --from=deps /app/lib ./lib
|
|
COPY ./src ./src
|
|
RUN if [ "${BUILD_ENV}" = "development" ]; then \
|
|
time shards build -Ddevelopment --static --verbose -s -p -t; \
|
|
else \
|
|
time shards build --static --release --no-debug --verbose -s -p -t; \
|
|
fi
|
|
|
|
FROM alpine as runner
|
|
WORKDIR /app
|
|
RUN adduser -S backend -u 1001
|
|
COPY --from=builder /app/bin ./bin
|
|
COPY ./db ./db
|
|
USER backend
|
|
EXPOSE 80
|
|
ENTRYPOINT [ "./bin/backend" ]
|
|
CMD [ "run" ]
|