-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (23 loc) · 709 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
# -*- mode: dockerfile -*-
# Dockerfile for spa-server
# You can override this `--build-arg BASE_IMAGE=...` to use different
# version of Rust
ARG BASE_IMAGE=rust:alpine
ARG RUNTIME_IMAGE=alpine
ARG APP_NAME=mqtt-auth-server
# Our first FROM statement declares the build environment.
FROM ${BASE_IMAGE} AS builder
# Add our source code.
ADD . .
RUN apk add --no-cache musl-dev
# Build our application.
RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo build --release
FROM ${RUNTIME_IMAGE}
RUN apk add --no-cache tini
EXPOSE 5800
ENTRYPOINT ["/sbin/tini", "--"]
# cmd can not use ARG
#CMD ${APP_NAME}
CMD mqtt-auth-server
COPY --from=builder ./target/release/${APP_NAME} /usr/bin/