-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
31 lines (21 loc) · 896 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
ARG BASE_IMAGE=debian:11-slim
ARG GO_IMAGE=golang:latest
FROM $GO_IMAGE as builder
# NOTE: This arg will be populated by docker buildx
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETARCH
RUN mkdir -p /go/src/github.com/daniel-widrick/mcPortKnock/
WORKDIR /go/src/github.com/daniel-widrick/mcPortKnock/
COPY . /go/src/github.com/daniel-widrick/mcPortKnock/
ARG GO111MODULE="on"
ENV GO111MODULE=${GO111MODULE}
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildmode=default -ldflags="-s -w"
FROM $BASE_IMAGE
ARG USER="nobody"
ARG GROUP="nogroup"
RUN mkdir /mcPortKnock && chown ${USER}:${GROUP} /mcPortKnock
COPY --from=builder --chown=${USER}:${GROUP} /go/src/github.com/daniel-widrick/mcPortKnock/mcPortKnock /mcPortKnock/mcPortKnock
USER ${USER}
WORKDIR /mcPortKnock
EXPOSE 25565
ENTRYPOINT ["/mcPortKnock/mcPortKnock"]