Files
attest-provider/Dockerfile

41 lines
1.2 KiB
Docker
Raw Normal View History

# 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"
FROM ${BUILDERIMAGE} AS builder
2024-05-23 10:19:55 -05: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
ARG VERSION="dev"
RUN --mount=type=bind,source=.,target=/app \
--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
FROM ${BASEIMAGE} AS production
2024-05-23 10:19:55 -05: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"]
FROM production AS dev
2024-07-01 15:01:44 +01:00
COPY --chown=65532:65532 certs/tls.crt certs/tls.key /certs/