-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
43 lines (28 loc) · 825 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
43
############################
# STEP 1 build executable binary
############################
FROM golang:1.16 AS builder
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
RUN go mod verify
COPY . .
RUN GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -ldflags="-w -s" -o main .
WORKDIR /app/build
RUN cp -r /app/main /app/LICENSE .
############################
# STEP 2 build service image
############################
FROM scratch
ARG COMMIT_SHA=<not-specified>
LABEL maintainer="%CUSTOM_PLUGIN_CREATOR_USERNAME%" \
name="mia_template_service_name_placeholder" \
description="%CUSTOM_PLUGIN_SERVICE_DESCRIPTION%" \
eu.mia-platform.url="https://www.mia-platform.eu" \
vcs.sha="$COMMIT_SHA"
WORKDIR /app
COPY --from=builder /app/build/* ./
# Use an unprivileged user.
USER 1000
CMD ["/app/main"]