Cleanup image building code, refactored, fewer exposed ports, templated files in runtime

This commit is contained in:
2024-06-30 10:18:51 -03:00
parent 4a6d77d0f4
commit 6a678944a0
7 changed files with 70 additions and 56 deletions

View File

@ -1,6 +1,6 @@
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as build
RUN apk update && apk upgrade && apk add crystal shards openssl-dev zlib-dev && apk cache clean
RUN apk update && apk upgrade && apk add crystal shards openssl-dev zlib-dev {{ ship_packages | join(" ") }} {{ devel_packages | join(" ") }} && apk cache clean
WORKDIR /home/app
@ -10,7 +10,7 @@ RUN shards build --release
RUN strip bin/*
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as ship
RUN apk update && apk upgrade && apk add openssl pcre2 libgcc gc libevent curl && apk cache clean
RUN apk update && apk upgrade && apk add openssl pcre2 libgcc gc libevent curl {{ ship_packages | join " " }} && apk cache clean
RUN addgroup -S app && adduser app -S -G app
WORKDIR /home/app
@ -19,4 +19,4 @@ USER app
COPY --from=build /home/app/bin/function .
CMD ["./function"]
HEALTHCHECK CMD curl --fail http://localhost:3000/ping || exit 1
HEALTHCHECK {{ healthcheck_options }} CMD {{ healthcheck_command }}