2020-11-23 15:59:06 +00:00
|
|
|
# syntax=docker/dockerfile:experimental
|
2021-03-04 04:40:00 +00:00
|
|
|
|
|
|
|
# Warning: this will not pick up migrations unless there are code changes
|
2021-05-03 14:46:12 +00:00
|
|
|
FROM rust:1.51-buster as rust
|
2020-11-23 15:59:06 +00:00
|
|
|
|
|
|
|
ENV HOME=/home/root
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Copy the source folders
|
|
|
|
COPY . ./
|
2021-04-12 11:47:58 +00:00
|
|
|
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
|
2020-11-23 15:59:06 +00:00
|
|
|
|
|
|
|
# Build for debug
|
|
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
|
|
--mount=type=cache,target=/app/target \
|
|
|
|
cargo build
|
|
|
|
RUN --mount=type=cache,target=/app/target \
|
|
|
|
cp target/debug/lemmy_server lemmy_server
|
|
|
|
|
|
|
|
FROM ubuntu:20.10
|
|
|
|
|
2021-04-01 17:30:24 +00:00
|
|
|
# Install libpq for postgres
|
2020-11-23 15:59:06 +00:00
|
|
|
RUN apt-get update -y
|
2021-08-18 15:54:05 +00:00
|
|
|
RUN apt-get install -y libpq-dev ca-certificates
|
2020-11-23 15:59:06 +00:00
|
|
|
|
|
|
|
# Copy resources
|
|
|
|
COPY --from=rust /app/lemmy_server /app/lemmy
|
|
|
|
|
|
|
|
EXPOSE 8536
|
|
|
|
CMD ["/app/lemmy"]
|