-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
49 lines (32 loc) · 1.01 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
40
41
42
43
44
45
46
47
48
49
FROM rust:slim-buster as builder
RUN apt-get update && apt-get install -y \
libssl-dev \
pkg-config \
libglib2.0-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
RUN USER=root cargo new --bin spritecollab-srv
WORKDIR /src/spritecollab-srv
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
RUN cargo build --release # collects dependencies
RUN rm src/*.rs # removes the `cargo new` generated files.
ADD . ./
RUN rm ./target/release/deps/spritecollab_srv*
RUN cargo build --release
RUN strip /src/spritecollab-srv/target/release/spritecollab-srv
FROM rust:slim-buster as build
ARG APP=/usr/src/app
EXPOSE 34434
ENV TZ=Etc/UTC \
APP_USER=spritecollab
RUN adduser --system --group $APP_USER
RUN apt-get update && apt-get install -y \
ca-certificates \
tzdata \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/spritecollab-srv/target/release/spritecollab-srv ${APP}/spritecollab-srv
RUN chown -R $APP_USER:$APP_USER ${APP}
USER $APP_USER
WORKDIR ${APP}
ENTRYPOINT ["./spritecollab-srv"]