Adding docker workspace caching. Fixes #940 (#958)

This commit is contained in:
Dessalines 2020-07-13 12:31:06 -04:00 committed by GitHub
parent ac56b57faa
commit 22a33929e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 22 deletions

14
docker/dev/Dockerfile vendored
View file

@ -17,20 +17,14 @@ WORKDIR /app
RUN sudo chown -R rust:rust . RUN sudo chown -R rust:rust .
RUN USER=root cargo new server RUN USER=root cargo new server
WORKDIR /app/server WORKDIR /app/server
RUN mkdir -p lemmy_db/src/ lemmy_utils/src/
COPY server/Cargo.toml server/Cargo.lock ./ COPY server/Cargo.toml server/Cargo.lock ./
COPY server/lemmy_db/Cargo.toml ./lemmy_db/ COPY server/lemmy_db ./lemmy_db
COPY server/lemmy_utils/Cargo.toml ./lemmy_utils/ COPY server/lemmy_utils ./lemmy_utils
RUN sudo chown -R rust:rust .
RUN mkdir -p ./src/bin \ RUN mkdir -p ./src/bin \
&& echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs \ && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
&& cp ./src/bin/main.rs ./lemmy_db/src/main.rs \
&& cp ./src/bin/main.rs ./lemmy_utils/src/main.rs
RUN cargo build RUN cargo build
RUN rm -f ./target/x86_64-unknown-linux-musl/release/deps/lemmy_server* RUN find target/debug -type f -name "$(echo "lemmy_server" | tr '-' '_')*" -exec touch -t 200001010000 {} +
COPY server/src ./src/ COPY server/src ./src/
COPY server/lemmy_db ./lemmy_db/
COPY server/lemmy_utils ./lemmy_utils/
COPY server/migrations ./migrations/ COPY server/migrations ./migrations/
# Build for debug # Build for debug

View file

@ -10,20 +10,15 @@ WORKDIR /app
RUN sudo chown -R rust:rust . RUN sudo chown -R rust:rust .
RUN USER=root cargo new server RUN USER=root cargo new server
WORKDIR /app/server WORKDIR /app/server
RUN mkdir -p lemmy_db/src/ lemmy_utils/src/ COPY server/Cargo.toml server/Cargo.lock ./
COPY --chown=rust:rust server/Cargo.toml server/Cargo.lock ./ COPY server/lemmy_db ./lemmy_db
COPY --chown=rust:rust server/lemmy_db/Cargo.toml ./lemmy_db/ COPY server/lemmy_utils ./lemmy_utils
COPY --chown=rust:rust server/lemmy_utils/Cargo.toml ./lemmy_utils/
RUN mkdir -p ./src/bin \ RUN mkdir -p ./src/bin \
&& echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs \ && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
&& cp ./src/bin/main.rs ./lemmy_db/src/main.rs \
&& cp ./src/bin/main.rs ./lemmy_utils/src/main.rs
RUN cargo build --release RUN cargo build --release
RUN rm -f ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/deps/lemmy_server* RUN find target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR -type f -name "$(echo "lemmy_server" | tr '-' '_')*" -exec touch -t 200001010000 {} +
COPY --chown=rust:rust server/src ./src/ COPY server/src ./src/
COPY --chown=rust:rust server/lemmy_db ./lemmy_db/ COPY server/migrations ./migrations/
COPY --chown=rust:rust server/lemmy_utils ./lemmy_utils/
COPY --chown=rust:rust server/migrations ./migrations/
# build for release # build for release
# workaround for https://github.com/rust-lang/rust/issues/62896 # workaround for https://github.com/rust-lang/rust/issues/62896