2024-06-28 17:09:58 +00:00
|
|
|
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as build
|
|
|
|
|
2024-06-28 20:16:20 +00:00
|
|
|
RUN apk update && apk upgrade && apk add crystal shards openssl-dev zlib-dev && apk cache clean
|
2024-06-28 17:09:58 +00:00
|
|
|
|
|
|
|
WORKDIR /home/app
|
|
|
|
|
2024-06-28 20:42:10 +00:00
|
|
|
COPY shard.yml *.cr ./
|
2024-06-28 17:09:58 +00:00
|
|
|
RUN shards install
|
2024-06-28 22:15:42 +00:00
|
|
|
RUN shards build --release
|
|
|
|
RUN strip bin/*
|
2024-06-28 17:09:58 +00:00
|
|
|
|
|
|
|
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as ship
|
2024-06-28 20:16:20 +00:00
|
|
|
RUN apk update && apk upgrade && apk add openssl pcre2 libgcc gc libevent && apk cache clean
|
2024-06-28 17:09:58 +00:00
|
|
|
RUN addgroup -S app && adduser app -S -G app
|
|
|
|
|
|
|
|
WORKDIR /home/app
|
|
|
|
USER app
|
|
|
|
|
2024-06-28 20:16:20 +00:00
|
|
|
COPY --from=build /home/app/bin/function .
|
2024-06-28 17:09:58 +00:00
|
|
|
|
2024-06-28 20:16:20 +00:00
|
|
|
CMD ["./function"]
|