-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
39 lines (29 loc) · 1.14 KB
/
Dockerfile
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
27
28
29
30
31
32
33
34
35
36
37
38
39
#
# Dockerfile for the crates-io-proxy server application
#
### First stage: Build the application itself.
FROM rust:alpine as builder
WORKDIR /builds/crates-io-proxy
# Copy source data (see .dockerignore for excludes).
COPY . .
# Install the build deps and build the application with cargo.
RUN \
apk add musl-dev && \
cargo build --release
### Second stage: Copy the built application into the runtime image.
FROM alpine:latest as runner
LABEL version="0.2.1"
LABEL description="crates.io proxy container image"
LABEL maintainer="Sergey Kvachonok <[email protected]>"
# Install the compiled executable into the system.
COPY --from=builder /builds/crates-io-proxy/target/release/crates-io-proxy /usr/bin/crates-io-proxy
# Add the proxy service user and create the crate files cache directory writable by it.
RUN \
adduser -SHD -u 777 -h /var/empty -s /sbin/nologin -g "crates.io proxy" cratesioxy && \
mkdir /var/cache/crates-io-proxy && \
chown cratesioxy /var/cache/crates-io-proxy
# Switch to the service user to run the proxy process.
USER cratesioxy
WORKDIR /var/empty
# Run the proxy server with the default configuration.
CMD crates-io-proxy --verbose