diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2020-09-13 15:48:17 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2020-09-13 15:48:17 -0700 |
commit | 001d2d3dccafea7b368cd6545a5a0b000a84ee76 (patch) | |
tree | 557783ec4afb7c773ae8f530ebadb8edec759792 | |
parent | 84f26898b3e3ebdd3b7192cfecb1e99d11eae3ff (diff) |
Add Dockerfile
-rw-r--r-- | .dockerignore | 2 | ||||
-rw-r--r-- | Dockerfile | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3ea0852 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +target/ +.git/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2bb732f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +# Based on https://alexbrand.dev/post/how-to-package-rust-applications-into-minimal-docker-containers/ +FROM rust:1.46.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 s3-media-endpoint-rs +WORKDIR /usr/src/s3-media-endpoint-rs +COPY Cargo.toml Cargo.lock ./ +RUN cargo install --path . + +# Copy the source and build the application. +COPY src ./src +RUN cargo install --path . + +# Now build the deployment image. +FROM debian:buster-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 +COPY --from=build /usr/local/cargo/bin/s3-media-endpoint-rs . +USER 999 +CMD ["./s3-media-endpoint-rs"] |