Skip to content

Commit

Permalink
Build hardened docker image for cloud-service-broker
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshochadel committed Mar 6, 2024
1 parent 91781a6 commit b7b91fa
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ci/container/external/cloud-service-broker/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
base-image: ubuntu-hardened
base-image-tag: "latest"
image-repository: cloud-service-broker
oci-build-params: {}
src-repo: cloudfoundry/cloud-service-broker
common-pipelines-trigger: false
dockerfile-path: ["container/dockerfiles/cloud-service-broker/Dockerfile"]
dockerfile-trigger: false
1 change: 1 addition & 0 deletions ci/container/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- var: name # repo, pipeline, and image name; all the same.
values:
- cf-cli-resource
- cloud-service-broker
- email-resource
- git-resource
- registry-image-resource
Expand Down
24 changes: 24 additions & 0 deletions container/dockerfiles/cloud-service-broker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Adapted from https://github.com/cloudfoundry/cloud-service-broker/blob/main/Dockerfile
FROM golang:1.22 AS build
WORKDIR /app
ADD . /app

ARG CSB_VERSION=0.0.0
RUN GOOS=linux go build -o ./build/cloud-service-broker -ldflags "-X github.com/cloudfoundry/cloud-service-broker/utils.Version=$CSB_VERSION"

# Dockerfile using our hardened base image
ARG base_image

FROM ${base_image}

COPY --from=build /app/build/cloud-service-broker /bin/cloud-service-broker

ADD https://s3.amazonaws.com/rds-downloads/rds-ca-2019-root.pem /usr/local/share/ca-certificates/
RUN update-ca-certificates

ENV PORT 8080
EXPOSE 8080/tcp

WORKDIR /bin
ENTRYPOINT ["/bin/cloud-service-broker"]
CMD ["help"]

0 comments on commit b7b91fa

Please sign in to comment.