Nicer/smaller crystal template

This commit is contained in:
Roberto Alsina 2023-06-02 17:21:10 -03:00
parent 0e5a41c170
commit d48cabc84f
1 changed files with 3 additions and 7 deletions

View File

@ -3,6 +3,7 @@ FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as build
RUN apk update && apk upgrade
RUN apk add crystal shards
RUN apk cache clean
WORKDIR /home/app
COPY . .
@ -12,22 +13,17 @@ RUN crystal build main.cr -o handler --release --static
RUN strip handler
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as ship
RUN apk update && apk upgrade
RUN apk update && apk upgrade && apk cache clean
# Add non root user
# Add non root user
RUN addgroup -S app && adduser app -S -G app
RUN chown app /home/app
WORKDIR /home/app
USER app
COPY --from=build /home/app/function/ .
COPY --from=build /home/app/handler .
COPY --from=watchdog /fwatchdog /home/app/fwatchdog
RUN chmod +x /home/app/fwatchdog
RUN chown -R app /home/app
USER app
ENV fprocess="./handler"
EXPOSE 8080