mentorenwahl/docker/backend/Dockerfile
Dominic Grimm 420ef6f984
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
Added backend Makefile
2022-02-07 19:25:18 +01:00

29 lines
666 B
Docker

FROM crystallang/crystal:1.3-alpine as deps
WORKDIR /app
RUN apk add curl --no-cache
COPY ./shard.yml ./shard.lock ./
RUN shards install --production
FROM crystallang/crystal:1.3-alpine as builder
ARG BUILD_ENV
WORKDIR /app/backend
COPY --from=deps /app/shard.yml /app/shard.lock ./
COPY --from=deps /app/lib ./lib
COPY ./Makefile ./Makefile
COPY ./LICENSE ./LICENSE
COPY ./src ./src
RUN if [ "${BUILD_ENV}" = "development" ]; then \
make dev; \
else \
make; \
fi
FROM alpine as runner
WORKDIR /app
RUN adduser -S backend -u 1001
COPY --from=builder /app/backend/bin ./bin
COPY ./db ./db
USER backend
EXPOSE 80
ENTRYPOINT [ "./bin/backend" ]
CMD [ "run" ]