[#16] tried changing dockerfile to buildkit (WIP)
This commit is contained in:
parent
4950c3660e
commit
7b9bf223c6
3 changed files with 7 additions and 5 deletions
|
|
@ -1,3 +1,5 @@
|
|||
# syntax = docker/dockerfile:1.2
|
||||
|
||||
# We use a multi-stage build to end up with a very small final image
|
||||
FROM alpine:latest AS builder
|
||||
|
||||
|
|
@ -18,8 +20,8 @@ COPY src/ ./src/
|
|||
# Thank the lords that this article exists
|
||||
# https://users.rust-lang.org/t/sigsegv-with-program-linked-against-openssl-in-an-alpine-container/52172
|
||||
# TODO add what these flags do & why they work
|
||||
RUN RUSTFLAGS="-C target-feature=-crt-static" cargo test && \
|
||||
RUSTFLAGS="-C target-feature=-crt-static" cargo build --release --bin fej
|
||||
RUN --mount=type=cache,target=/usr/src/app/target RUSTFLAGS="-C target-feature=-crt-static" cargo test && \
|
||||
RUSTFLAGS="-C target-feature=-crt-static" cargo install --path . --bin fej --root /usr/local/bin
|
||||
|
||||
|
||||
# Now, we create the actual image
|
||||
|
|
@ -29,6 +31,6 @@ FROM alpine:latest
|
|||
RUN apk update && apk add --no-cache openssl libgcc
|
||||
|
||||
# Copy binary over to final image
|
||||
COPY --from=builder /usr/src/app/target/release/fej /usr/local/bin/fej
|
||||
COPY --from=builder /usr/local/bin/fej /usr/local/bin/fej
|
||||
|
||||
CMD ["/usr/local/bin/fej"]
|
||||
|
|
|
|||
Reference in a new issue