-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
51 lines (32 loc) · 1.09 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
50
51
ARG VERSION=1
FROM rust:${VERSION}-buster AS builder
############################
# STAGE 1 build the binary
############################
# The below line should match the package name in Cargo.toml
ARG APP_NAME="veloxide-server"
RUN cargo new --bin ${APP_NAME}
WORKDIR ./${APP_NAME}
COPY . ./
ARG DATABASE_KIND="mysql"
RUN cargo prisma generate && cargo build --release --features ${DATABASE_KIND}
############################
# STAGE 2 build a small image
############################
FROM debian:buster-slim
ARG APP=/usr/src/app
RUN apt-get update \
&& apt-get install -y ca-certificates tzdata \
&& rm -rf /var/lib/apt/lists/*
ENV TZ=Europe/Amsterdam \
APP_USER=appuser
RUN groupadd $APP_USER \
&& useradd -g $APP_USER $APP_USER \
&& mkdir -p ${APP}
COPY --from=builder /veloxide-server/target/release/veloxide-server ${APP}/veloxide-server
RUN chown -R $APP_USER:$APP_USER ${APP}
EXPOSE 8080
USER $APP_USER
WORKDIR ${APP}
# HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 CMD curl -f http://localhost:8080/health || exit 1
ENTRYPOINT ["./veloxide-server"]