forked from yojo-art/files-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
22 lines (21 loc) · 900 Bytes
/
Dockerfile
File metadata and controls
22 lines (21 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM rust:alpine
RUN apk add --no-cache musl-dev curl
RUN curl -sSL https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz | tar -zxf - -C /tmp && mv /tmp/sccache*/sccache /usr/local/bin && rm -rf /tmp/sccache*
ENV CARGO_HOME=/var/cache/cargo
RUN mkdir /app
WORKDIR /app
COPY src ./src
COPY Cargo.toml ./Cargo.toml
ENV RUSTC_WRAPPER=/usr/local/bin/sccache
ENV SCCACHE_DIR=/var/cache/sccache
RUN --mount=type=cache,target=/var/cache/cargo --mount=type=cache,target=/var/cache/sccache cargo build --target x86_64-unknown-linux-musl --release
FROM alpine:latest
ARG UID="851"
ARG GID="851"
RUN addgroup -g "${GID}" proxy && adduser -u "${UID}" -G proxy -D -h /files-proxy -s /bin/sh proxy
WORKDIR /files-proxy
USER proxy
COPY --from=0 /app/target/x86_64-unknown-linux-musl/release/server ./files-proxy
EXPOSE 8080
EXPOSE 23725
CMD ["./files-proxy"]