github.com/amazechain/amc@v0.1.3/Dockerfile (about) 1 # Build 2 FROM golang:1.19-alpine3.15 AS builder 3 4 # RUN apk add --no-cache gcc musl-dev linux-headers git make 5 RUN apk add --no-cache build-base linux-headers git bash ca-certificates libstdc++ 6 7 WORKDIR /amc 8 ADD . . 9 ENV GO111MODULE="on" 10 RUN go mod tidy && go build -o ./build/bin/amazechain ./cmd/amc 11 12 13 FROM alpine:3.15 14 #libstdc++ 15 RUN apk add --no-cache ca-certificates curl tzdata 16 # copy compiled artifacts from builder 17 COPY --from=builder /amc/build/bin/* /usr/local/bin/ 18 19 # Setup user and group 20 # 21 # from the perspective of the container, uid=1000, gid=1000 is a sensible choice, but if caller creates a .env 22 # (example in repo root), these defaults will get overridden when make calls docker-compose 23 ARG UID=1000 24 ARG GID=1000 25 RUN adduser -D -u $UID -g $GID amc 26 27 28 ENV AMCDATA /home/amc/data 29 # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values) 30 RUN mkdir -p "$AMCDATA" && chown -R amc:amc "$AMCDATA" && chmod 777 "$AMCDATA" 31 VOLUME /home/amc/data 32 33 USER amc 34 WORKDIR /home/amc 35 36 RUN echo $UID 37 38 EXPOSE 20012 20013 20014 61015/udp 61016 6060 39 ENTRYPOINT ["amazechain"]