2019-04-27 00:56:33 +00:00
|
|
|
# Setup env
|
|
|
|
FROM rust:1.33
|
2019-04-27 08:51:08 +00:00
|
|
|
RUN USER=root cargo new --bin /opt/lemmy/server--dev
|
2019-04-27 00:56:33 +00:00
|
|
|
WORKDIR /opt/lemmy/server--dev
|
|
|
|
# Create empty directory where the frontend would normally be
|
|
|
|
RUN mkdir -p /opt/lemmy/ui--dev/dist
|
|
|
|
# Enable deps caching
|
|
|
|
RUN mkdir -p src/bin
|
|
|
|
RUN echo 'fn main() { println!("Dummy") }' >src/bin/main.rs
|
|
|
|
# Install deps
|
|
|
|
COPY Cargo.toml .
|
|
|
|
COPY Cargo.lock .
|
2019-04-27 08:51:08 +00:00
|
|
|
RUN cargo build --release
|
|
|
|
RUN rm src/bin/main.rs
|
2019-04-27 00:56:33 +00:00
|
|
|
# Add app
|
2019-04-27 08:51:08 +00:00
|
|
|
COPY src/ src/
|
|
|
|
COPY migrations/ migrations/
|
|
|
|
RUN rm target/release/deps/lemmy*
|
|
|
|
RUN cargo build --release
|
2019-04-27 00:56:33 +00:00
|
|
|
# Run app
|
2019-04-27 08:51:08 +00:00
|
|
|
CMD ["/opt/lemmy/server--dev/target/release/lemmy"]
|