Created
December 28, 2019 14:06
-
-
Save watsy0007/3e54cb13014719e9fa6dc2f83b849a06 to your computer and use it in GitHub Desktop.
crystal smallest docker file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FROM alpine:latest as builder | |
# RUN apk add -u crystal shards libc-dev | |
# WORKDIR /src | |
# COPY . . | |
# RUN crystal build --release src/api_demo.cr -o /src/api_demo | |
# FROM busybox | |
# WORKDIR /app | |
# COPY --from=builder /src/api_demo /app/api_demo | |
# ENTRYPOINT ["/app/api_demo"] | |
FROM crystallang/crystal:latest as builder | |
WORKDIR /src | |
COPY . . | |
RUN shards build --production --progress --verbose --warnings=all | |
RUN ldd ./bin/api_demo | tr -s '[:blank:]' '\n' | grep '^/' | xargs -I % sh -c 'mkdir -p $(dirname deps%); cp % deps%;' | |
RUN find ./deps/ | |
RUN ls /src/bin | |
FROM scratch | |
COPY --from=builder /src/deps / | |
COPY --from=builder /lib/x86_64-linux-gnu/libnss_dns.so.* /lib/x86_64-linux-gnu/ | |
COPY --from=builder /lib/x86_64-linux-gnu/libresolv.so.* /lib/x86_64-linux-gnu/ | |
COPY --from=builder /src/bin/api_demo /app | |
ENTRYPOINT [ "/app" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment