Historico ported to crystal
This commit is contained in:
@ -1,24 +1,31 @@
|
||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/of-watchdog:0.9.10 as watchdog
|
||||
|
||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as build
|
||||
ARG ADDITIONAL_PACKAGE
|
||||
|
||||
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
|
||||
|
||||
RUN apk update && apk upgrade && apk add crystal shards openssl-dev && apk cache clean
|
||||
RUN apk update && apk upgrade && apk add crystal shards openssl-dev ${ADDITIONAL_PACKAGE} && apk cache clean
|
||||
|
||||
WORKDIR /home/app
|
||||
|
||||
COPY . .
|
||||
COPY function/shard.yml shard.yml
|
||||
RUN shards install
|
||||
RUN crystal build main.cr -o handler --release && strip handler && rm -rf /root/.cache
|
||||
RUN crystal build main.cr -o handler -p && strip handler && rm -rf /root/.cache
|
||||
|
||||
# Create a non-root user
|
||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as ship
|
||||
ARG ADDITIONAL_PACKAGE
|
||||
RUN apk update && apk upgrade && apk add openssl pcre2 libgcc gc libevent ${ADDITIONAL_PACKAGE} && apk cache clean
|
||||
# Add non root user
|
||||
# Add non root user
|
||||
RUN addgroup -S app && adduser app -S -G app
|
||||
|
||||
WORKDIR /home/app
|
||||
USER app
|
||||
|
||||
WORKDIR /home/app
|
||||
COPY --from=build /home/app/function/ .
|
||||
COPY --from=build /home/app/handler .
|
||||
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
|
||||
|
||||
ENV fprocess="./handler"
|
||||
EXPOSE 8080
|
||||
|
Reference in New Issue
Block a user