1- FROM docker.io/library/golang:1.17
1+ FROM docker.io/drycc/base:bullseye
22
33LABEL name="drycc-go-dev"
44
5- ENV ENVTPL_VERSION=v1.0.0
6- ENV GOLANGCI_LINT_VERSION=v1.42.1
5+ ENV GO_VERSION=1.17.7
6+ ENV GOLANGCI_LINT_VERSION=v1.44.2
77
88# This is a huge one-liner to optimize the Docker image layer.
99# We disable source repos to speed up apt-get update.
1010RUN export DEBIAN_FRONTEND=noninteractive \
11- && apt-get update -y --no-install-recommends \
12- && apt-get install -y --no-install-recommends \
11+ && install-packages \
1312 lsb-release \
1413 bash \
1514 build-essential \
@@ -35,6 +34,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
3534 zip \
3635 shellcheck \
3736 etcd \
37+ && install-stack go $GO_VERSION && . init-stack \
3838 && curl -o /usr/local/bin/kubectl \
3939 -L "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/$(dpkg --print-architecture)/kubectl" \
4040 && chmod +x /usr/local/bin/kubectl \
@@ -44,25 +44,13 @@ RUN export DEBIAN_FRONTEND=noninteractive \
4444 github.com/axw/gocov/gocov \
4545 github.com/mitchellh/gox \
4646 github.com/mgechev/revive \
47- && git clone --dept 1 -b $ENVTPL_VERSION https://github.com/subfuzion/envtpl $GOPATH/src/github.com/subfuzion/envtpl \
48- && cd $GOPATH/src/github.com/subfuzion/envtpl \
49- && export GO111MODULE=on \
50- && CGO_ENABLED=0 go build \
51- -ldflags "-X main.AppVersionMetadata=$(date -u +%s)" \
52- -a -installsuffix cgo -o /bin/envtpl ./cmd/envtpl/. \
53- && git clone --dept 1 https://github.com/buildpacks/pack -b v0.23.0 /tmp/pack \
54- && cd /tmp/pack \
55- && make \
56- && cp /tmp/pack/out/pack /usr/local/bin \
57- && chmod +x /usr/local/bin/pack \
58- && rm -rf /tmp/pack \
59- && curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin $GOLANGCI_LINT_VERSION \
60- && bash -c "mkdir -p /var/lib/shared/{overlay-images,overlay-layers}" \
61- && bash -c "touch /var/lib/shared/{overlay-images/images.lock,overlay-layers/layers.lock}" \
47+ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin $GOLANGCI_LINT_VERSION \
48+ && mkdir -p /var/lib/shared/{overlay-images,overlay-layers} \
49+ && touch /var/lib/shared/{overlay-images/images.lock,overlay-layers/layers.lock} \
6250 && apt-get autoremove -y \
6351 && apt-get clean -y \
6452 && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc
6553
66- WORKDIR /go
54+ WORKDIR /opt/drycc/ go
6755
6856COPY . /
0 commit comments