[#16] tried changing dockerfile to buildkit (WIP)

master
Jef Roosens 2021-04-08 23:56:08 +02:00
parent 4950c3660e
commit 7b9bf223c6
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
3 changed files with 7 additions and 5 deletions

View File

@ -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"]

2
build
View File

@ -26,7 +26,7 @@ else
fi
# Run the actual build command
docker build -t "$1:$tags" .
DOCKER_BUILDKIT=1 docker build -t "$1:$tags" .
if [[ "$2" = push ]]; then
[[ "$branch" =~ ^develop|master$ ]] || {

View File

@ -1,5 +1,5 @@
# Ivago
This part of the API is a wrapper around the Ivago website (Ivago being the
company that collects the trash in my city). Their city isn't exactly RESTful,
company that collects the trash in my city). Their site isn't exactly RESTful,
so this endpoint simply wraps it in a RESTful wrapper.