-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
42 lines (32 loc) · 1008 Bytes
/
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
# syntax=docker/dockerfile:experimental
# ------------------------------ env stage ------------------------------
#
ARG RUST_VERSION=1.32-slim
ARG VCS_REF
ARG BUILD_DATE
ARG BINARY_NAME
FROM rust:${RUST_VERSION} as develop_env
RUN apt-get update -y && apt-get install -y \
vim \
curl
WORKDIR /usr/src/app/
EXPOSE 8000
# ------------------------------ build stage ------------------------------
#
FROM develop_env as builder
COPY . /usr/src/app
WORKDIR /usr/src/app/
RUN ["cargo", "build", "--release"]
# ------------------------------ prod stage ------------------------------
#
FROM rust:${RUST_VERSION} as prod
COPY --from=builder /usr/src/app/target/release/$BINARY_NAME /usr/src/app/$BINARY_NAME
ARG VCS_REF
ARG BUILD_DATE
ARG BINARY_NAME
LABEL org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.vcs-url="https://github.com/Sieciechu/rust-test"
EXPOSE 8000
ENV BINARY_NAME=${BINARY_NAME}
CMD /usr/src/app/$BINARY_NAME