mirror of https://github.com/LemmyNet/lemmy.git
Merge branch 'prod_dockerfile_update' into main
commit
5b871d3dd8
|
@ -1,12 +1,8 @@
|
||||||
# build folders and similar which are not needed for the docker build
|
# build folders and similar which are not needed for the docker build
|
||||||
ui/node_modules
|
target
|
||||||
server/target
|
|
||||||
docker/dev/volumes
|
docker/dev/volumes
|
||||||
|
docker/prod/volumes
|
||||||
docker/federation/volumes
|
docker/federation/volumes
|
||||||
docker/federation-test/volumes
|
docker/travis/volumes
|
||||||
.git
|
.git
|
||||||
ansible
|
ansible
|
||||||
|
|
||||||
# exceptions, needed for federation-test build
|
|
||||||
|
|
||||||
!server/target/debug/lemmy_server
|
|
||||||
|
|
|
@ -1,33 +1,14 @@
|
||||||
ARG RUST_BUILDER_IMAGE=shtripok/rust-musl-builder:arm
|
ARG RUST_BUILDER_IMAGE=ekidd/rust-musl-builder:stable
|
||||||
|
|
||||||
FROM $RUST_BUILDER_IMAGE as rust
|
FROM $RUST_BUILDER_IMAGE as rust
|
||||||
|
|
||||||
#ARG RUSTRELEASEDIR="debug"
|
ARG CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
|
||||||
ARG RUSTRELEASEDIR="release"
|
ARG RUSTRELEASEDIR="release"
|
||||||
|
|
||||||
# Cache deps
|
|
||||||
WORKDIR /app
|
|
||||||
RUN sudo chown -R rust:rust .
|
|
||||||
RUN USER=root cargo new server
|
|
||||||
WORKDIR /app/server
|
WORKDIR /app/server
|
||||||
COPY Cargo.toml Cargo.lock ./
|
RUN sudo chown -R rust:rust .
|
||||||
COPY lemmy_db ./lemmy_db
|
COPY . ./
|
||||||
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
|
|
||||||
RUN cargo build --release
|
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
|
# reduce binary size
|
||||||
RUN strip ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server
|
RUN strip ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server
|
||||||
|
|
Loading…
Reference in New Issue