Skip to content

Commit

Permalink
[.github] - chore: debugging logs front docker (#9400)
Browse files Browse the repository at this point in the history
* [front] - refactor: reorganize ARG and ENV instructions in Dockerfile

 - Move ARG instructions for build arguments to the top of the Dockerfile
 - Declare and echo build arguments before setting them as environment variables

* [k8s] - feature: display build arguments during cloudbuild process

 - Added echo statements to print the build arguments for better visibility during the build process
  • Loading branch information
JulesBelveze authored Dec 16, 2024
1 parent 6980516 commit dcc9959
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
26 changes: 16 additions & 10 deletions front/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ FROM node:20.13.0 AS front

RUN apt-get update && apt-get install -y vim redis-tools postgresql-client htop

ARG COMMIT_HASH
ARG NEXT_PUBLIC_VIZ_URL
ARG NEXT_PUBLIC_GA_TRACKING_ID
ARG NEXT_PUBLIC_DUST_CLIENT_FACING_URL

RUN echo "Build arguments received:" && \
echo "COMMIT_HASH=$COMMIT_HASH" && \
echo "NEXT_PUBLIC_VIZ_URL=$NEXT_PUBLIC_VIZ_URL" && \
echo "NEXT_PUBLIC_GA_TRACKING_ID=$NEXT_PUBLIC_GA_TRACKING_ID" && \
echo "NEXT_PUBLIC_DUST_CLIENT_FACING_URL=$NEXT_PUBLIC_DUST_CLIENT_FACING_URL"

ENV NEXT_PUBLIC_COMMIT_HASH=$COMMIT_HASH
ENV NEXT_PUBLIC_VIZ_URL=$NEXT_PUBLIC_VIZ_URL
ENV NEXT_PUBLIC_GA_TRACKING_ID=$NEXT_PUBLIC_GA_TRACKING_ID
ENV NEXT_PUBLIC_DUST_CLIENT_FACING_URL=$NEXT_PUBLIC_DUST_CLIENT_FACING_URL

WORKDIR /types
COPY /types/package*.json ./
COPY /types/ .
Expand All @@ -21,16 +37,6 @@ RUN npm ci

COPY /front .

ARG COMMIT_HASH
ARG NEXT_PUBLIC_VIZ_URL
ARG NEXT_PUBLIC_GA_TRACKING_ID
ARG NEXT_PUBLIC_DUST_CLIENT_FACING_URL

ENV NEXT_PUBLIC_COMMIT_HASH=$COMMIT_HASH
ENV NEXT_PUBLIC_VIZ_URL=$NEXT_PUBLIC_VIZ_URL
ENV NEXT_PUBLIC_GA_TRACKING_ID=$NEXT_PUBLIC_GA_TRACKING_ID
ENV NEXT_PUBLIC_DUST_CLIENT_FACING_URL=$NEXT_PUBLIC_DUST_CLIENT_FACING_URL

# fake database URIs are needed because Sequelize will throw if the `url` parameter
# is undefined, and `next build` imports the `models.ts` file while "Collecting page data"
RUN FRONT_DATABASE_URI="sqlite:foo.sqlite" npm run build
Expand Down
3 changes: 3 additions & 0 deletions k8s/cloudbuild_tmp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ steps:
build_args+=("--build-arg" "${key}=${value}")
fi
done < <(yq .env -o=props .github/configs/${_REGION}.yaml)
echo "BUILD ARGUMENTS:"
echo ${build_args[@]}
depot build \
--project 3vz0lnf16v \
Expand Down

0 comments on commit dcc9959

Please sign in to comment.