-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDockerfile
48 lines (34 loc) · 1.21 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
FROM rust:latest AS builder
RUN apt-get update && apt-get install -y \
autoconf \
automake \
libtool \
curl \
make \
gcc \
g++ \
unzip \
pkg-config \
openssl \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# install protoc
RUN curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v26.0/protoc-26.0-linux-x86_64.zip -o protobuf.zip \
&& unzip protobuf.zip -d /usr/local/bin \
&& rm protobuf.zip
ENV PROTOC=/usr/local/bin/bin/protoc
ENV PATH=$PATH:/usr/local/bin/bin/protoc
WORKDIR /usr/src/app
#COPY Cargo.toml Cargo.lock /usr/src/app/
COPY . /usr/src/app/
RUN cargo build --release
FROM debian:stable-slim
RUN apt-get update && apt-get install -y --no-install-recommends apt
RUN apt-get update && apt-get install -y --no-install-recommends openssl
COPY --from=builder /usr/src/app/target/release/service /usr/local/bin/service
COPY --from=builder /usr/src/app/service/config/config.toml /usr/local/bin/config.toml
WORKDIR /
RUN adduser --disabled-password --gecos '' --uid 1000 appuser && chown -R appuser:appuser /usr/local/bin/service
USER appuser
EXPOSE 50000
CMD ["/usr/local/bin/service --config /usr/local/bin/config.toml"]