go/Dockerfile

39 lines
1.0 KiB
Docker
Raw Normal View History

2020-03-04 15:14:31 +00:00
FROM golang:1.14-alpine
2019-02-02 12:04:44 +00:00
ENV TZ=Europe/Moscow
ENV TERM=xterm-color
2019-07-21 19:52:51 +00:00
2019-02-02 12:04:44 +00:00
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
ENV GO111MODULE=on
2019-07-21 19:52:51 +00:00
2020-09-20 06:28:57 +00:00
ENV GOLANGCI=1.31.0
2020-07-26 20:12:35 +00:00
ENV GOSWAG=1.6.7
2019-02-02 12:04:44 +00:00
RUN \
apk add --no-cache --update bash curl git tzdata && \
rm -rf /var/cache/apk/*
RUN \
cp /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo "${TZ}" > /etc/timezone && date
RUN \
2019-09-01 17:19:32 +00:00
# install golangci-lint
go get -u -v github.com/golangci/golangci-lint/cmd/golangci-lint@v${GOLANGCI} && \
2020-03-04 15:14:31 +00:00
cd /go/pkg/mod/github.com/golangci/golangci-lint@v${GOLANGCI} && \
go install -ldflags "-X 'main.version=${GOLANGCI}' -X 'main.date=$(date)'" github.com/golangci/golangci-lint/cmd/golangci-lint && \
cd / && \
2019-09-01 17:19:32 +00:00
# install goswag
go get -u -v github.com/swaggo/swag/cmd/swag@v${GOSWAG} && \
2020-03-04 15:14:31 +00:00
cd /go/pkg/mod/github.com/swaggo/swag@v${GOSWAG} && \
go install github.com/swaggo/swag/cmd/swag && \
2020-03-04 15:14:31 +00:00
cd / && \
2019-09-01 17:19:32 +00:00
# cleanup
go clean -cache -modcache && \
# print versions
go version && \
golangci-lint --version && \
2019-07-21 19:52:51 +00:00
swag --version