awesome-compose/react-rust-postgres/backend/Dockerfile
Jérémie Drouet b73e252639 react-rust-postgres: add connection to postgres with migrations
Signed-off-by: Jérémie Drouet <jeremie.drouet@gmail.com>
2020-03-26 10:39:45 +01:00

36 lines
613 B
Docker

FROM jdrouet/rust-nightly:buster-slim AS base
RUN apt-get update \
&& apt-get install -y libpq-dev \
&& rm -rf /var/lib/apt/lists/*
ENV USER=root
ENV ROCKET_ADDRESS=0.0.0.0
ENV ROCKET_ENV=development
WORKDIR /code
RUN cargo init
COPY Cargo.toml /code/Cargo.toml
RUN cargo fetch
COPY . /code
FROM base AS development
EXPOSE 8000
CMD [ "cargo", "run", "--offline" ]
FROM base AS builder
RUN cargo build --release --offline
FROM debian:buster-slim
ENV ROCKET_ENV=production
EXPOSE 8000
COPY --from=builder /code/target/release/react-rust-postgres /react-rust-postgres
CMD [ "/react-rust-postgres" ]