From 8d6b8fb09c551d536c9a0b2dce78763dd08646aa Mon Sep 17 00:00:00 2001 From: Adrien Date: Fri, 12 Apr 2024 23:04:40 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Life=20is=20more=20complicated..?= =?UTF-8?q?.=20make=20the=20number=20of=20jobs=20configurable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 5 +++++ .woodpecker/.deploy.yaml | 8 ++------ Dockerfile | 13 +++++-------- 3 files changed, 12 insertions(+), 14 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f3c1e35 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +# .git directory is not filtered here: we need to copy the .git directory in the builder image to compute the version. +dist +medias +README.md +target diff --git a/.woodpecker/.deploy.yaml b/.woodpecker/.deploy.yaml index c001c54..5163eec 100644 --- a/.woodpecker/.deploy.yaml +++ b/.woodpecker/.deploy.yaml @@ -7,9 +7,8 @@ steps: tags: ${CI_COMMIT_SHA} cache: true auto_tag: true - # build_args: - # - COMMIT_SHA=${CI_COMMIT_SHA} - # - COMMIT_AUTHOR_EMAIL=${CI_COMMIT_AUTHOR_EMAIL} + build_args: + - JOBS_NB=1 # limit the number of jobs to run in order to limit the consumed RAM username: nologin password: from_secret: registry-password @@ -20,6 +19,3 @@ steps: requests: memory: "1.5Gi" cpu: "1" - # limits: - # memory: 2Gi - # cpu: "2" diff --git a/Dockerfile b/Dockerfile index d8ae571..b232d36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,17 @@ FROM rust:latest AS builder +ARG JOBS_NB=${JOBS_NB:-default} + # Disable incremental compilation # Cf. https://doc.rust-lang.org/cargo/reference/profiles.html#incremental ARG CARGO_INCREMENTAL=0 WORKDIR /usr/src/beau-gosse-du-92 -COPY ./fonts ./fonts -COPY ./images ./images -COPY ./Dioxus.toml . -COPY Cargo.* . -COPY ./build.rs . -COPY ./src ./src +COPY . . -RUN cargo install dioxus-cli -RUN dx build -r --platform web +RUN cargo -j ${JOBS_NB} install dioxus-cli +RUN dx build -r --platform web -- -j ${JOBS_NB} FROM nginx:mainline-alpine-slim