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

refactor: Applied docker build practices #5375

Merged
merged 8 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions tool/actions-plan-preview/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.4-alpine3.20 as builder
FROM golang:1.22.4-alpine3.20 AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
Expand All @@ -7,6 +7,6 @@ RUN go build -o /plan-preview .

FROM ghcr.io/pipe-cd/pipectl:v0.43.1
COPY --from=builder /plan-preview /
ENV PATH $PATH:/app/cmd/pipectl
ENV PATH=$PATH:/app/cmd/pipectl
RUN chmod +x /plan-preview
ENTRYPOINT ["/plan-preview"]
6 changes: 3 additions & 3 deletions tool/codegen/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Builder image to build go program.
FROM golang:1.23 as BUILDER
FROM golang:1.23 AS builder

COPY protoc-gen-auth /protoc-gen-auth
RUN cd /protoc-gen-auth \
Expand Down Expand Up @@ -50,10 +50,10 @@ RUN for target in x86_64 aarch_64; do \
&& chmod +x bin/protoc-gen-js \
&& rm -rf protobuf-javascript-${PROTOC_GEN_JS_VER}-linux-${target}.tar.gz; \
done && \
mv /protoc-gen-js-aarch_64/ /protoc-gen-js-aarch64/
mv /protoc-gen-js-aarch_64/ /protoc-gen-js-aarch64/

# protoc-gen-auth
COPY --from=BUILDER /usr/local/bin/protoc-gen-auth /usr/local/bin/
COPY --from=builder /usr/local/bin/protoc-gen-auth /usr/local/bin/

# gomock
RUN go install github.com/golang/mock/mockgen@v${GOMOCK_VER}
Expand Down
5 changes: 3 additions & 2 deletions tool/firestore-emulator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ FROM google/cloud-sdk:$GOOGLE_CLOUD_SDK_VERSION

RUN apk add --update --no-cache openjdk11-jre-headless

ENV FIRESTORE_PROJECT_ID "pipecd-test"
ENV FIRESTORE_PROJECT_ID="pipecd-test"
RUN gcloud config set project $FIRESTORE_PROJECT_ID && gcloud components install cloud-firestore-emulator beta --quiet

ENV PORT 8080
ENV PORT=8080
EXPOSE "$PORT"

SHELL ["/bin/sh", "-c"]
ENTRYPOINT gcloud beta emulators firestore start --host-port="0.0.0.0:${PORT}"
3 changes: 1 addition & 2 deletions tool/piped-base-okd/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# check=skip=SecretsUsedInArgOrEnv
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following code was pointed out to me, but I ignored it because it was a false positve.

ENV NSS_WRAPPER_PASSWD=$PIPED_HOME/passwd

ref. https://docs.docker.com/build/checks/#skip-checks

# https://github.com/pipe-cd/pipecd/pkgs/container/piped-base/103341355?tag=v0.44.0-alpha-52-ge881cac
FROM ghcr.io/pipe-cd/piped-base@sha256:18a5a6af6507c8c70c5442d19651a2000672c78fc5dd91cfd3c0af26c899c1d3

Expand All @@ -18,12 +19,10 @@ RUN \
make \
jq \
cmake && \

# Install glibc to be used for building nss_wrapper.
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.33-r0/glibc-2.33-r0.apk && \
apk add glibc-2.33-r0.apk && \

# Install nss_wrapper to add an random UID to "passwd" at runtime without having to directly modify /etc/passwd.
/installer/install-nss-wrapper.sh && \
# Remove what were used for installation.
Expand Down
Loading