2021-04-13 15:19:20 +02:00
|
|
|
# syntax=docker/dockerfile:1.2
|
2020-08-17 16:20:02 +02:00
|
|
|
|
|
|
|
|
2020-09-22 12:13:00 +02:00
|
|
|
# Copyright 2020 Docker Compose CLI authors
|
2020-06-18 16:13:24 +02:00
|
|
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2020-09-22 12:13:00 +02:00
|
|
|
|
update go to 1.18.4
go1.18.4 (released 2022-07-12) includes security fixes to the compress/gzip,
encoding/gob, encoding/xml, go/parser, io/fs, net/http, and path/filepath
packages, as well as bug fixes to the compiler, the go command, the linker,
the runtime, and the runtime/metrics package. See the Go 1.18.4 milestone on the
issue tracker for details:
https://github.com/golang/go/issues?q=milestone%3AGo1.18.4+label%3ACherryPickApproved
This update addresses:
CVE-2022-1705, CVE-2022-1962, CVE-2022-28131, CVE-2022-30630, CVE-2022-30631,
CVE-2022-30632, CVE-2022-30633, CVE-2022-30635, and CVE-2022-32148.
Full diff: https://github.com/golang/go/compare/go1.18.3...go1.18.4
From the security announcement;
https://groups.google.com/g/golang-announce/c/nqrv9fbR0zE
We have just released Go versions 1.18.4 and 1.17.12, minor point releases. These
minor releases include 9 security fixes following the security policy:
- net/http: improper sanitization of Transfer-Encoding header
The HTTP/1 client accepted some invalid Transfer-Encoding headers as indicating
a "chunked" encoding. This could potentially allow for request smuggling, but
only if combined with an intermediate server that also improperly failed to
reject the header as invalid.
This is CVE-2022-1705 and https://go.dev/issue/53188.
- When `httputil.ReverseProxy.ServeHTTP` was called with a `Request.Header` map
containing a nil value for the X-Forwarded-For header, ReverseProxy would set
the client IP as the value of the X-Forwarded-For header, contrary to its
documentation. In the more usual case where a Director function set the
X-Forwarded-For header value to nil, ReverseProxy would leave the header
unmodified as expected.
This is https://go.dev/issue/53423 and CVE-2022-32148.
Thanks to Christian Mehlmauer for reporting this issue.
- compress/gzip: stack exhaustion in Reader.Read
Calling Reader.Read on an archive containing a large number of concatenated
0-length compressed files can cause a panic due to stack exhaustion.
This is CVE-2022-30631 and Go issue https://go.dev/issue/53168.
- encoding/xml: stack exhaustion in Unmarshal
Calling Unmarshal on a XML document into a Go struct which has a nested field
that uses the any field tag can cause a panic due to stack exhaustion.
This is CVE-2022-30633 and Go issue https://go.dev/issue/53611.
- encoding/xml: stack exhaustion in Decoder.Skip
Calling Decoder.Skip when parsing a deeply nested XML document can cause a
panic due to stack exhaustion. The Go Security team discovered this issue, and
it was independently reported by Juho Nurminen of Mattermost.
This is CVE-2022-28131 and Go issue https://go.dev/issue/53614.
- encoding/gob: stack exhaustion in Decoder.Decode
Calling Decoder.Decode on a message which contains deeply nested structures
can cause a panic due to stack exhaustion.
This is CVE-2022-30635 and Go issue https://go.dev/issue/53615.
- path/filepath: stack exhaustion in Glob
Calling Glob on a path which contains a large number of path separators can
cause a panic due to stack exhaustion.
Thanks to Juho Nurminen of Mattermost for reporting this issue.
This is CVE-2022-30632 and Go issue https://go.dev/issue/53416.
- io/fs: stack exhaustion in Glob
Calling Glob on a path which contains a large number of path separators can
cause a panic due to stack exhaustion.
This is CVE-2022-30630 and Go issue https://go.dev/issue/53415.
- go/parser: stack exhaustion in all Parse* functions
Calling any of the Parse functions on Go source code which contains deeply
nested types or declarations can cause a panic due to stack exhaustion.
Thanks to Juho Nurminen of Mattermost for reporting this issue.
This is CVE-2022-1962 and Go issue https://go.dev/issue/53616.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-13 12:40:24 +02:00
|
|
|
ARG GO_VERSION=1.18.4-alpine
|
2022-07-13 01:00:36 +02:00
|
|
|
ARG GOLANGCI_LINT_VERSION=v1.46.2-alpine
|
2020-10-27 14:09:28 +01:00
|
|
|
ARG PROTOC_GEN_GO_VERSION=v1.4.3
|
2020-04-22 10:04:11 +02:00
|
|
|
|
2022-07-13 01:00:36 +02:00
|
|
|
FROM --platform=${BUILDPLATFORM} golangci/golangci-lint:${GOLANGCI_LINT_VERSION} AS local-golangci-lint
|
|
|
|
|
2020-05-29 11:30:12 +02:00
|
|
|
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS base
|
2020-08-21 17:24:53 +02:00
|
|
|
WORKDIR /compose-cli
|
2021-04-13 15:19:20 +02:00
|
|
|
RUN apk add --no-cache -vv \
|
2020-08-18 16:10:34 +02:00
|
|
|
git \
|
2020-05-29 11:30:12 +02:00
|
|
|
docker \
|
|
|
|
make \
|
2020-06-05 16:28:18 +02:00
|
|
|
protoc \
|
|
|
|
protobuf-dev
|
2020-05-29 11:30:12 +02:00
|
|
|
COPY go.* .
|
2020-09-23 17:13:27 +02:00
|
|
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
2021-05-19 16:59:21 +02:00
|
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
2020-09-23 17:13:27 +02:00
|
|
|
go mod download
|
2020-05-04 23:49:40 +02:00
|
|
|
|
2020-05-22 13:04:27 +02:00
|
|
|
FROM base AS lint
|
|
|
|
ENV CGO_ENABLED=0
|
2022-07-13 01:00:36 +02:00
|
|
|
COPY --from=local-golangci-lint /usr/bin/golangci-lint /usr/bin/golangci-lint
|
2020-11-18 17:18:15 +01:00
|
|
|
ARG BUILD_TAGS
|
2020-07-07 15:48:09 +02:00
|
|
|
ARG GIT_TAG
|
2020-05-29 11:30:12 +02:00
|
|
|
RUN --mount=target=. \
|
2020-09-23 17:13:27 +02:00
|
|
|
--mount=type=cache,target=/go/pkg/mod \
|
2020-05-29 11:30:12 +02:00
|
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
|
|
|
--mount=type=cache,target=/root/.cache/golangci-lint \
|
2020-11-18 17:18:15 +01:00
|
|
|
BUILD_TAGS=${BUILD_TAGS} \
|
2020-07-07 15:48:09 +02:00
|
|
|
GIT_TAG=${GIT_TAG} \
|
2020-05-22 13:04:27 +02:00
|
|
|
make -f builder.Makefile lint
|
|
|
|
|
2021-05-27 12:10:37 +02:00
|
|
|
FROM base AS make-compose-plugin
|
|
|
|
ENV CGO_ENABLED=0
|
|
|
|
ARG TARGETOS
|
|
|
|
ARG TARGETARCH
|
|
|
|
ARG BUILD_TAGS
|
|
|
|
ARG GIT_TAG
|
|
|
|
RUN --mount=target=. \
|
|
|
|
--mount=type=cache,target=/go/pkg/mod \
|
|
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
|
|
|
GOOS=${TARGETOS} \
|
|
|
|
GOARCH=${TARGETARCH} \
|
|
|
|
BUILD_TAGS=${BUILD_TAGS} \
|
|
|
|
GIT_TAG=${GIT_TAG} \
|
|
|
|
make COMPOSE_BINARY=/out/docker-compose -f builder.Makefile compose-plugin
|
2020-04-22 10:04:11 +02:00
|
|
|
|
2020-05-14 13:35:55 +02:00
|
|
|
FROM base AS make-cross
|
2020-06-15 17:41:59 +02:00
|
|
|
ARG BUILD_TAGS
|
2020-07-07 15:48:09 +02:00
|
|
|
ARG GIT_TAG
|
2020-05-29 11:30:12 +02:00
|
|
|
RUN --mount=target=. \
|
2020-09-23 17:13:27 +02:00
|
|
|
--mount=type=cache,target=/go/pkg/mod \
|
2020-05-29 11:30:12 +02:00
|
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
2020-06-15 17:41:59 +02:00
|
|
|
BUILD_TAGS=${BUILD_TAGS} \
|
2020-07-07 15:48:09 +02:00
|
|
|
GIT_TAG=${GIT_TAG} \
|
2021-08-31 18:53:24 +02:00
|
|
|
make COMPOSE_BINARY=/out/docker-compose -f builder.Makefile cross
|
2020-05-01 15:27:27 +02:00
|
|
|
|
2021-05-27 12:10:37 +02:00
|
|
|
FROM scratch AS compose-plugin
|
|
|
|
COPY --from=make-compose-plugin /out/* .
|
|
|
|
|
2020-05-04 10:32:30 +02:00
|
|
|
FROM scratch AS cross
|
2020-05-29 11:30:12 +02:00
|
|
|
COPY --from=make-cross /out/* .
|
2020-04-22 10:04:11 +02:00
|
|
|
|
2020-12-04 17:33:52 +01:00
|
|
|
FROM base AS test
|
2020-05-20 14:32:56 +02:00
|
|
|
ENV CGO_ENABLED=0
|
2020-07-07 15:48:09 +02:00
|
|
|
ARG BUILD_TAGS
|
|
|
|
ARG GIT_TAG
|
2020-05-29 11:30:12 +02:00
|
|
|
RUN --mount=target=. \
|
2020-09-23 17:13:27 +02:00
|
|
|
--mount=type=cache,target=/go/pkg/mod \
|
2020-05-29 11:30:12 +02:00
|
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
2020-06-15 17:41:59 +02:00
|
|
|
BUILD_TAGS=${BUILD_TAGS} \
|
2020-07-07 15:48:09 +02:00
|
|
|
GIT_TAG=${GIT_TAG} \
|
2020-05-22 13:26:30 +02:00
|
|
|
make -f builder.Makefile test
|
2020-08-17 15:18:47 +02:00
|
|
|
|
2020-12-04 17:33:52 +01:00
|
|
|
FROM base AS check-license-headers
|
2022-07-26 15:13:34 +02:00
|
|
|
RUN go install github.com/google/addlicense@latest
|
2020-08-17 15:18:47 +02:00
|
|
|
RUN --mount=target=. \
|
2020-08-17 16:20:02 +02:00
|
|
|
make -f builder.Makefile check-license-headers
|
|
|
|
|
2020-12-04 17:48:15 +01:00
|
|
|
FROM base AS make-go-mod-tidy
|
|
|
|
COPY . .
|
|
|
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
2021-05-19 16:59:21 +02:00
|
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
2020-12-04 17:48:15 +01:00
|
|
|
go mod tidy
|
|
|
|
|
|
|
|
FROM scratch AS go-mod-tidy
|
|
|
|
COPY --from=make-go-mod-tidy /compose-cli/go.mod .
|
|
|
|
COPY --from=make-go-mod-tidy /compose-cli/go.sum .
|
|
|
|
|
2020-12-04 17:33:52 +01:00
|
|
|
FROM base AS check-go-mod
|
2020-08-18 11:53:17 +02:00
|
|
|
COPY . .
|
2020-09-23 17:13:40 +02:00
|
|
|
RUN make -f builder.Makefile check-go-mod
|
2022-06-24 18:40:04 +02:00
|
|
|
|
|
|
|
# docs-reference is a target used as remote context to update docs on release
|
|
|
|
# with latest changes on docker.github.io.
|
|
|
|
# see open-pr job in .github/workflows/docs.yml for more details
|
|
|
|
FROM scratch AS docs-reference
|
|
|
|
COPY docs/reference/*.yaml .
|