Files
docker-nginx-full/docker/Dockerfile.golang
T
2021-05-10 13:03:49 +10:00

30 lines
923 B
Docker

FROM golang:latest as go
FROM jc21/nginx-full:${BASE_TAG:-latest}
ARG TARGETPLATFORM
RUN echo "Golang: jc21/nginx-full:${BASE_TAG:-latest}, ${TARGETPLATFORM:-linux/amd64}" >> /built-for-arch
LABEL maintainer="Jamie Curnow <jc@jc21.com>"
RUN apt-get update \
&& apt-get install -y wget gcc g++ make git sqlite3 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# copy go from golang
COPY --from=go /usr/local/go /usr/local/go
ENV GOPATH=/opt/go PATH="/usr/local/go/bin:$PATH:/opt/go/bin"
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" \
&& chmod -R 777 "$GOPATH" \
&& echo "====> ${TARGETPLATFORM}: $(go version)"
WORKDIR /root
# Gotools
RUN if [ "$TARGETPLATFORM" == "" ] || [ "$TARGETPLATFORM" == "linux/amd64" ]; then cd /usr && wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.39.0; fi
RUN go get -u github.com/kyoh86/richgo \
&& rm -rf /root/.cache/go-build