-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (26 loc) · 838 Bytes
/
Dockerfile
File metadata and controls
38 lines (26 loc) · 838 Bytes
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
# syntax=docker/dockerfile:1
ARG RUST_VERSION=1.78.0
ARG APP_NAME=msg_decoder
################################################################################
FROM rust:${RUST_VERSION}-alpine AS build
ARG APP_NAME
WORKDIR /app
RUN apk upgrade --update-cache --available && \
apk add clang lld musl-dev git pkgconfig build-base openssl openssl-libs-static openssl-dev
COPY . /app
RUN cargo build --release && \
cp ./target/release/$APP_NAME /bin/server
################################################################################
FROM alpine:3.18 AS production
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
USER appuser
COPY --from=build /bin/server /bin/
CMD ["/bin/server"]