Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add bullseye container #147

Merged
merged 6 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .build/bullseye.yaml
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'
3 changes: 2 additions & 1 deletion .build/release_artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ fi

# Build and push the container images
gcloud builds submit --async --config .build/default.yaml --substitutions _VERSION=$VERSION
gcloud builds submit --async --config .build/buster.yaml --substitutions _VERSION=$VERSION
gcloud builds submit --async --config .build/alpine.yaml --substitutions _VERSION=$VERSION
gcloud builds submit --async --config .build/buster.yaml --substitutions _VERSION=$VERSION
gcloud builds submit --async --config .build/bullseye.yaml --substitutions _VERSION=$VERSION

# Build the binarys and upload to GCS
gcloud builds submit --config .build/gcs_upload.yaml --substitutions _VERSION=$VERSION
Expand Down
38 changes: 38 additions & 0 deletions Dockerfile.bullseye
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2020 Google LLC
enocom marked this conversation as resolved.
Show resolved Hide resolved
#
# 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/cloudsql-proxy
enocom marked this conversation as resolved.
Show resolved Hide resolved
COPY . .

ARG TARGETOS
ARG TARGETARCH

RUN go get ./...
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -ldflags "-X main.metadataString=container.buster" -o cloud_sql_proxy ./cmd/cloud_sql_proxy

# 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/cloudsql-proxy/cloud_sql_proxy /cloud_sql_proxy
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ currently supported:
* `$VERSION-alpine` - uses [`alpine:3`](https://hub.docker.com/_/alpine) as a
base image
* `$VERSION-buster` - uses [`debian:buster`](https://hub.docker.com/_/debian) as
* `$VERSION-bullseye` - uses [`debian:bullseye`](https://hub.docker.com/_/debian) as
a base image

We recommend using the latest version of the proxy and updating the version
Expand Down