74f22d2a71
debian:buster-slim -> debian:buster-slim@sha256:557ee531b81ce380d012d83b7bb56211572e5d6088d3e21a3caef7d7ed7f718b [atomist:generated] [atomist-skill:atomist/docker-base-image-policy] Signed-off-by: Atomist Bot <bot@atomist.com>
50 lines
994 B
Docker
50 lines
994 B
Docker
# syntax=docker/dockerfile:1.4
|
|
FROM rust:buster@sha256:f5da153862af6a25fcf49dde3cb19b5b513f78bc00e317eb64e898a66af2881d AS base
|
|
|
|
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 dev-envs
|
|
|
|
EXPOSE 8000
|
|
RUN <<EOF
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends git
|
|
EOF
|
|
|
|
RUN <<EOF
|
|
useradd -s /bin/bash -m vscode
|
|
groupadd docker
|
|
usermod -aG docker vscode
|
|
EOF
|
|
# install Docker tools (cli, buildx, compose)
|
|
COPY --from=gloursdocker/docker / /
|
|
CMD [ "cargo", "run", "--offline" ]
|
|
|
|
FROM base AS builder
|
|
|
|
RUN cargo build --release --offline
|
|
|
|
FROM debian:buster-slim@sha256:557ee531b81ce380d012d83b7bb56211572e5d6088d3e21a3caef7d7ed7f718b
|
|
|
|
ENV ROCKET_ENV=production
|
|
|
|
EXPOSE 8000
|
|
|
|
COPY --from=builder /code/target/release/react-rust-postgres /react-rust-postgres
|
|
|
|
CMD [ "/react-rust-postgres" ]
|