mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
Merge branch 'fix_docker_caching' into structs_separate
This commit is contained in:
commit
88978077b5
25
docker/dev/Dockerfile
vendored
25
docker/dev/Dockerfile
vendored
@ -10,27 +10,36 @@ RUN yarn install --pure-lockfile
|
|||||||
COPY ui /app/ui
|
COPY ui /app/ui
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
FROM ekidd/rust-musl-builder:1.42.0-openssl11 as rust
|
FROM ekidd/rust-musl-builder:nightly-2020-05-07 as rust
|
||||||
|
|
||||||
# Cache deps
|
# Cache deps
|
||||||
WORKDIR /app
|
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
|
||||||
|
|
||||||
|
# Install cargo-build-deps
|
||||||
|
RUN cargo install --git https://github.com/romac/cargo-build-deps.git
|
||||||
WORKDIR /app/server
|
WORKDIR /app/server
|
||||||
|
RUN mkdir -p lemmy_db/src/ lemmy_utils/src/
|
||||||
|
|
||||||
|
# Copy the cargo tomls
|
||||||
COPY server/Cargo.toml server/Cargo.lock ./
|
COPY server/Cargo.toml server/Cargo.lock ./
|
||||||
COPY server/lemmy_db ./lemmy_db
|
COPY server/lemmy_db/Cargo.toml ./lemmy_db/
|
||||||
COPY server/lemmy_utils ./lemmy_utils
|
COPY server/lemmy_utils/Cargo.toml ./lemmy_utils/
|
||||||
RUN mkdir -p ./src/bin \
|
|
||||||
&& echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
|
# Cache the deps
|
||||||
RUN cargo build
|
RUN cargo build-deps
|
||||||
RUN find target/debug -type f -name "$(echo "lemmy_server" | tr '-' '_')*" -exec touch -t 200001010000 {} +
|
|
||||||
|
# Copy the src folders
|
||||||
COPY server/src ./src/
|
COPY server/src ./src/
|
||||||
|
COPY server/lemmy_db/src ./lemmy_db/src/
|
||||||
|
COPY server/lemmy_utils/src/ ./lemmy_utils/src/
|
||||||
COPY server/migrations ./migrations/
|
COPY server/migrations ./migrations/
|
||||||
|
|
||||||
# Build for debug
|
# Build for debug
|
||||||
RUN cargo build
|
RUN cargo build
|
||||||
|
|
||||||
FROM ekidd/rust-musl-builder:1.42.0-openssl11 as docs
|
FROM ekidd/rust-musl-builder:nightly-2020-05-07 as docs
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY docs ./docs
|
COPY docs ./docs
|
||||||
RUN sudo chown -R rust:rust .
|
RUN sudo chown -R rust:rust .
|
||||||
|
4
docker/dev/docker-compose.yml
vendored
4
docker/dev/docker-compose.yml
vendored
@ -3,9 +3,7 @@ version: '3.3'
|
|||||||
services:
|
services:
|
||||||
|
|
||||||
lemmy:
|
lemmy:
|
||||||
build:
|
image: lemmy-dev:latest
|
||||||
context: ../../
|
|
||||||
dockerfile: docker/dev/Dockerfile
|
|
||||||
ports:
|
ports:
|
||||||
- "8536:8536"
|
- "8536:8536"
|
||||||
restart: always
|
restart: always
|
||||||
|
5
docker/dev/docker_update.sh
vendored
5
docker/dev/docker_update.sh
vendored
@ -1,7 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
export COMPOSE_DOCKER_CLI_BUILD=1
|
|
||||||
export DOCKER_BUILDKIT=1
|
|
||||||
sudo chown -R 991:991 volumes/pictrs
|
sudo chown -R 991:991 volumes/pictrs
|
||||||
sudo docker-compose up -d --no-deps --build
|
sudo docker build ../../ --file ../dev/Dockerfile -t lemmy-dev:latest
|
||||||
|
sudo docker-compose up -d
|
||||||
|
4
server/lemmy_db/Cargo.toml
vendored
4
server/lemmy_db/Cargo.toml
vendored
@ -3,6 +3,10 @@ name = "lemmy_db"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "lemmy_db"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
diesel = { version = "1.4.4", features = ["postgres","chrono","r2d2","64-column-tables","serde_json"] }
|
diesel = { version = "1.4.4", features = ["postgres","chrono","r2d2","64-column-tables","serde_json"] }
|
||||||
chrono = { version = "0.4.7", features = ["serde"] }
|
chrono = { version = "0.4.7", features = ["serde"] }
|
||||||
|
4
server/lemmy_utils/Cargo.toml
vendored
4
server/lemmy_utils/Cargo.toml
vendored
@ -3,6 +3,10 @@ name = "lemmy_utils"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "lemmy_utils"
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
Loading…
Reference in New Issue
Block a user