summaryrefslogtreecommitdiff
path: root/Dockerfile
blob: c1354eb31026c1a947451afdc72005b630d82e35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Based on https://alexbrand.dev/post/how-to-package-rust-applications-into-minimal-docker-containers/
FROM rust:1.57.0 AS build

MAINTAINER Jesse Morgan <jesse@jesterpm.net>

WORKDIR /usr/src

# Build the dependencies first
# This should help repeated builds go faster.
RUN USER=root cargo new flowerpot
WORKDIR /usr/src/flowerpot
COPY Cargo.toml Cargo.lock ./
RUN cargo build --release

# Copy the source and build the application.
COPY src ./src
RUN cargo install --path .

# Now build the deployment image.
FROM debian:stable-slim
# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y libssl1.1 ca-certificates sqlite3
COPY --from=build /usr/local/cargo/bin/flowerpot .
COPY www ./www
USER 999
CMD ["./flowerpot"]