2024-10-18 09:33:52 -05:00
|
|
|
# Copyright Docker attest-provider authors
|
2024-10-17 13:48:16 -05: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.
|
2024-05-23 10:52:35 -05:00
|
|
|
ARG BUILDERIMAGE="golang:1.22"
|
2024-05-23 10:19:55 -05:00
|
|
|
ARG BASEIMAGE="gcr.io/distroless/static:nonroot"
|
|
|
|
|
|
2024-07-01 10:50:18 +01:00
|
|
|
FROM ${BUILDERIMAGE} AS builder
|
2024-05-23 10:19:55 -05:00
|
|
|
|
2024-07-01 10:50:18 +01:00
|
|
|
ENV CGO_ENABLED=0
|
2024-05-23 10:19:55 -05:00
|
|
|
|
2024-06-28 16:59:35 +01:00
|
|
|
WORKDIR /app
|
2024-05-23 10:19:55 -05:00
|
|
|
|
2024-09-09 17:11:44 +00:00
|
|
|
ARG VERSION="dev"
|
|
|
|
|
|
2024-07-01 10:50:18 +01:00
|
|
|
RUN --mount=type=bind,source=.,target=/app \
|
2024-10-23 10:23:58 +01:00
|
|
|
--mount=type=cache,target=$GOPATH/pkg/mod \
|
|
|
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
|
|
|
|
go build -ldflags "-X main.version=$VERSION" -o /bin/attest main.go
|
2024-05-23 10:19:55 -05:00
|
|
|
|
2024-07-01 10:50:18 +01:00
|
|
|
FROM ${BASEIMAGE} AS production
|
2024-05-23 10:19:55 -05:00
|
|
|
|
2024-07-01 10:50:18 +01:00
|
|
|
COPY --from=builder /bin/attest /
|
2024-05-23 10:19:55 -05:00
|
|
|
|
|
|
|
|
USER 65532:65532
|
|
|
|
|
|
2024-05-23 10:52:35 -05:00
|
|
|
ENTRYPOINT ["/attest"]
|
2024-07-01 10:50:18 +01:00
|
|
|
|
|
|
|
|
FROM production AS dev
|
|
|
|
|
|
2024-07-01 15:01:44 +01:00
|
|
|
COPY --chown=65532:65532 certs/tls.crt certs/tls.key /certs/
|