From: Dessalines Date: Mon, 26 Oct 2020 17:33:43 +0000 (-0400) Subject: Simplifying prod build, using musl stable. (#1235) X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/save/%22%7B%7D/static/%7BrepoUrl%7D?a=commitdiff_plain;h=604d125a55f12d024ad7dc992c632c0d6fb2e047;p=lemmy.git Simplifying prod build, using musl stable. (#1235) --- diff --git a/.dockerignore b/.dockerignore index 255caf67..b336eeeb 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,12 +1,8 @@ # build folders and similar which are not needed for the docker build -ui/node_modules -server/target +target docker/dev/volumes +docker/prod/volumes docker/federation/volumes -docker/federation-test/volumes +docker/travis/volumes .git ansible - -# exceptions, needed for federation-test build - -!server/target/debug/lemmy_server diff --git a/docker/prod/Dockerfile b/docker/prod/Dockerfile index 137adc46..09c542f0 100644 --- a/docker/prod/Dockerfile +++ b/docker/prod/Dockerfile @@ -1,33 +1,12 @@ -ARG RUST_BUILDER_IMAGE=shtripok/rust-musl-builder:arm +ARG RUST_BUILDER_IMAGE=ekidd/rust-musl-builder:stable FROM $RUST_BUILDER_IMAGE as rust -#ARG RUSTRELEASEDIR="debug" ARG RUSTRELEASEDIR="release" -# Cache deps -WORKDIR /app -RUN sudo chown -R rust:rust . -RUN USER=root cargo new server WORKDIR /app/server -COPY Cargo.toml Cargo.lock ./ -COPY lemmy_db ./lemmy_db -COPY lemmy_utils ./lemmy_utils -COPY lemmy_structs ./lemmy_structs -COPY lemmy_rate_limit ./lemmy_rate_limit -COPY lemmy_api ./lemmy_api -COPY lemmy_apub ./lemmy_apub -COPY lemmy_websocket ./lemmy_websocket -RUN mkdir -p ./src/bin \ - && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs +COPY . ./ RUN cargo build --release -RUN find target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR -type f -name "$(echo "lemmy_server" | tr '-' '_')*" -exec touch -t 200001010000 {} + -COPY src ./src/ -COPY migrations ./migrations/ - -# build for release -# workaround for https://github.com/rust-lang/rust/issues/62896 -RUN cargo build --frozen --release # reduce binary size RUN strip ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server