Skip to content

Commit

Permalink
Reworked docker image to latest alpine + native rust builder
Browse files Browse the repository at this point in the history
  • Loading branch information
konstantinzolotarev committed Apr 12, 2024
1 parent 0e09fc1 commit 99be92a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
# syntax=docker/dockerfile:1.4

FROM alpine:3.19 as build-environment
FROM rust:alpine3.19 as build-environment

ARG TARGETARCH
WORKDIR /opt

RUN apk add clang lld curl build-base linux-headers git pkgconf openssl-dev \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh \
&& chmod +x ./rustup.sh \
&& ./rustup.sh -y
RUN apk add lld build-base linux-headers pkgconf openssl-dev
# RUN apk add clang lld curl build-base linux-headers git pkgconf openssl-dev \
# && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh \
# && chmod +x ./rustup.sh \
# && ./rustup.sh -y

RUN [[ "$TARGETARCH" = "arm64" ]] && echo "export CFLAGS=-mno-outline-atomics" >> $HOME/.profile || true

WORKDIR /opt/challenger
COPY . .

RUN --mount=type=cache,target=/root/.cargo/registry --mount=type=cache,target=/root/.cargo/git --mount=type=cache,target=/opt/challenger/target \
source $HOME/.profile && cargo build --release \
source $HOME/.profile \
&& RUSTFLAGS="-Ctarget-feature=-crt-static" cargo build --release \
&& mkdir out \
&& mv target/release/challenger out/challenger \
&& strip out/challenger;

FROM frolvlad/alpine-glibc:alpine-3.19_glibc-2.34 as challenger-client
FROM alpine:3.19 as challenger-client

RUN apk add --no-cache linux-headers git
RUN apk add --no-cache linux-headers gcompat libgcc

COPY --from=build-environment /opt/challenger/out/challenger /usr/local/bin/challenger

Expand Down

0 comments on commit 99be92a

Please sign in to comment.