-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# 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. | ||
|
||
steps: | ||
- name: gcr.io/cloud-builders/docker | ||
args: | ||
- run | ||
- '--privileged' | ||
- 'linuxkit/binfmt:v0.7' | ||
id: 'initialize-qemu' | ||
- name: gcr.io/cloud-builders/docker | ||
args: | ||
- buildx | ||
- create | ||
- '--name' | ||
- multiarch-builder | ||
id: 'create-builder' | ||
- name: gcr.io/cloud-builders/docker | ||
args: | ||
- buildx | ||
- use | ||
- multiarch-builder | ||
id: 'select-builder' | ||
- name: gcr.io/cloud-builders/docker | ||
args: | ||
- buildx | ||
- inspect | ||
- '--bootstrap' | ||
id: 'show-target-build-platforms' | ||
- name: 'gcr.io/cloud-builders/docker' | ||
args: | ||
- 'buildx' | ||
- 'build' | ||
- '--platform' | ||
- $_DOCKER_BUILDX_PLATFORMS | ||
- '--tag=gcr.io/$PROJECT_ID/gce-proxy:${_VERSION}-bullseye' | ||
- '--tag=us.gcr.io/$PROJECT_ID/gce-proxy:${_VERSION}-bullseye' | ||
- '--tag=eu.gcr.io/$PROJECT_ID/gce-proxy:${_VERSION}-bullseye' | ||
- '--tag=asia.gcr.io/$PROJECT_ID/gce-proxy:${_VERSION}-bullseye' | ||
- '-f=Dockerfile.bullseye' | ||
- '--push' | ||
- '.' | ||
id: 'build-multi-architecture-container-image' | ||
options: | ||
env: | ||
- DOCKER_CLI_EXPERIMENTAL=enabled | ||
substitutions: | ||
_DOCKER_BUILDX_PLATFORMS: 'linux/amd64,linux/arm64' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2022 Google LLC | ||
# | ||
# 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. | ||
|
||
# Use the latest stable golang 1.x to compile to a binary | ||
FROM --platform=$BUILDPLATFORM golang:1 as build | ||
|
||
WORKDIR /go/src/alloydb-auth-proxy | ||
COPY . . | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
RUN go get ./... | ||
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ | ||
go build -ldflags "-X main.metadataString=container.bullseye" | ||
|
||
# Final stage | ||
FROM debian:bullseye | ||
RUN apt-get update && apt-get install -y ca-certificates | ||
# Install fuse and allow enable non-root users to mount | ||
RUN apt-get update && apt-get install -y fuse && sed -i 's/^#user_allow_other$/user_allow_other/g' /etc/fuse.conf | ||
# Add a non-root user matching the nonroot user from the main container | ||
RUN groupadd -g 65532 -r nonroot && useradd -u 65532 -g 65532 -r nonroot | ||
# Set the uid as an integer for compatibility with runAsNonRoot in Kubernetes | ||
USER 65532 | ||
|
||
COPY --from=build --chown=nonroot /go/src/alloydb-auth-proxy/alloydb-auth-proxy /alloydb-auth-proxy | ||
ENTRYPOINT ["/alloydb-auth-proxy"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters