diff --git a/Dockerfile b/Dockerfile index a84064f..98cb462 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,15 +6,16 @@ RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static protobuf-dev lld WORKDIR /app -# this optimizes build time by putting the dependencies in a seperate docker layer, speeding up future builds COPY Cargo.toml Cargo.lock ./ COPY mii ./mii -RUN mkdir src && echo "fn main() {}" > src/main.rs && cargo fetch +RUN mkdir src && echo "fn main() {println!(\"dummy\");}" > src/main.rs +RUN OPENSSL_STATIC=1 cargo build --target x86_64-unknown-linux-musl --profile prod COPY . . -ENV SQLX_OFFLINE=true +RUN touch src/main.rs +ENV SQLX_OFFLINE=true RUN OPENSSL_LIB_DIR=/usr/lib OPENSSL_INCLUDE_DIR=/usr/include/openssl OPENSSL_STATIC=1 RUSTFLAGS="-C target-feature=+aes,+sse -C relocation-model=static -C linker=ld.lld" cargo build --profile prod --target x86_64-unknown-linux-musl FROM scratch AS final