-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
37 lines (25 loc) · 1.16 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
FROM golang:1.22.8 AS builder
# Set some shell options for using pipes and such
SHELL [ "/bin/bash", "-euo", "pipefail", "-c" ]
# Install common CA certificates to blag later
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends ca-certificates \
&& apt-get autoremove --assume-yes \
&& rm -rf /root/.cache
# Don't call any C code (the 'scratch' base image used later won't have any libraries to reference)
ENV CGO_ENABLED=0
WORKDIR /go/src/github.com/TykTechnologies/mserv
COPY . .
RUN go build -ldflags="-buildid= -w" -trimpath -v -o /bin/mserv
RUN mkdir -p /opt/mserv/downloads /opt/mserv/plugins
FROM gcr.io/distroless/base:nonroot AS runner
USER 65532
ENV TYK_MSERV_CONFIG /etc/mserv/mserv.json
LABEL Description="Tyk MServ service docker image" Vendor="Tyk" Version=$TYKVERSION
WORKDIR /opt/mserv
# Bring common CA certificates and binary over.
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /bin/mserv /opt/mserv/mserv
COPY --from=builder /opt/mserv/downloads /opt/mserv/downloads
COPY --from=builder /opt/mserv/plugins /opt/mserv/plugins
ENTRYPOINT [ "/opt/mserv/mserv" ]