Nicer/smaller crystal template
This commit is contained in:
parent
0e5a41c170
commit
d48cabc84f
@ -3,6 +3,7 @@ FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as build
|
|||||||
|
|
||||||
RUN apk update && apk upgrade
|
RUN apk update && apk upgrade
|
||||||
RUN apk add crystal shards
|
RUN apk add crystal shards
|
||||||
|
RUN apk cache clean
|
||||||
WORKDIR /home/app
|
WORKDIR /home/app
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
@ -12,22 +13,17 @@ RUN crystal build main.cr -o handler --release --static
|
|||||||
RUN strip handler
|
RUN strip handler
|
||||||
|
|
||||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine as ship
|
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
|
||||||
# Add non root user
|
# Add non root user
|
||||||
RUN addgroup -S app && adduser app -S -G app
|
RUN addgroup -S app && adduser app -S -G app
|
||||||
RUN chown app /home/app
|
|
||||||
|
|
||||||
WORKDIR /home/app
|
WORKDIR /home/app
|
||||||
|
USER app
|
||||||
|
|
||||||
COPY --from=build /home/app/function/ .
|
COPY --from=build /home/app/function/ .
|
||||||
COPY --from=build /home/app/handler .
|
COPY --from=build /home/app/handler .
|
||||||
COPY --from=watchdog /fwatchdog /home/app/fwatchdog
|
COPY --from=watchdog /fwatchdog /home/app/fwatchdog
|
||||||
RUN chmod +x /home/app/fwatchdog
|
|
||||||
|
|
||||||
RUN chown -R app /home/app
|
|
||||||
|
|
||||||
USER app
|
|
||||||
|
|
||||||
ENV fprocess="./handler"
|
ENV fprocess="./handler"
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
Loading…
Reference in New Issue
Block a user