From d2415d1fc8c6647cc6f8ecb3191f31b0a0fd8c7f Mon Sep 17 00:00:00 2001 From: Jeremy Lewi Date: Thu, 11 Apr 2024 08:16:02 -0700 Subject: [PATCH 1/4] Add build arguments for version, date, and commit information to Dockerfile and update build script to include generating a version.json file with this information. --- frontend/foyle/Dockerfile | 5 +++++ frontend/foyle/build.sh | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/foyle/Dockerfile b/frontend/foyle/Dockerfile index e76c962a..626f8e2d 100644 --- a/frontend/foyle/Dockerfile +++ b/frontend/foyle/Dockerfile @@ -3,6 +3,11 @@ # The main difference is that we don't install vscode in the container; i.e. we don't call the install-vscode.sh script. FROM mcr.microsoft.com/devcontainers/typescript-node:18-bookworm as build +# Build Args need to be after the FROM stage otherwise they don't get passed through to the RUN statment +ARG VERSION=unknown +ARG DATE=unknown +ARG COMMIT=unknown + # Not sure why this is needed since its not in the dev container. RUN apt-get update -y && \ apt-get install -y libxkbfile-dev diff --git a/frontend/foyle/build.sh b/frontend/foyle/build.sh index 21d453a4..14e37f3a 100755 --- a/frontend/foyle/build.sh +++ b/frontend/foyle/build.sh @@ -3,4 +3,13 @@ # This is useful for running in a container to build the fronted set -ex yarn -yarn package-web \ No newline at end of file +yarn package-web + +cat > dist/version.json < Date: Thu, 11 Apr 2024 08:29:48 -0700 Subject: [PATCH 2/4] hydros committing changes before build --- frontend/foyle/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/foyle/build.sh b/frontend/foyle/build.sh index 14e37f3a..c1ac5fec 100755 --- a/frontend/foyle/build.sh +++ b/frontend/foyle/build.sh @@ -5,7 +5,7 @@ set -ex yarn yarn package-web -cat > dist/version.json < version.json < Date: Thu, 11 Apr 2024 08:41:04 -0700 Subject: [PATCH 3/4] hydros committing changes before build --- frontend/foyle/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/foyle/Dockerfile b/frontend/foyle/Dockerfile index 626f8e2d..6c00784e 100644 --- a/frontend/foyle/Dockerfile +++ b/frontend/foyle/Dockerfile @@ -22,4 +22,6 @@ FROM scratch COPY --from=build /foyle/package.json /foyle/package.json COPY --from=build /foyle/package.nls.json /foyle/package.nls.json +# version.json gets builts in build.sh +COPY --from=build /foyle/version.json /foyle/version.json COPY --from=build /foyle/dist /foyle/dist \ No newline at end of file From 809b2a5f007c0903d93638dd56bd0d19b99026b0 Mon Sep 17 00:00:00 2001 From: Jeremy Lewi Date: Thu, 11 Apr 2024 08:54:23 -0700 Subject: [PATCH 4/4] Set version.json in webassets --- frontend/vscode/web-assets/Dockerfile | 5 +++++ frontend/vscode/web-assets/build.sh | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/vscode/web-assets/Dockerfile b/frontend/vscode/web-assets/Dockerfile index 0d39499c..e4ab956e 100644 --- a/frontend/vscode/web-assets/Dockerfile +++ b/frontend/vscode/web-assets/Dockerfile @@ -1,6 +1,11 @@ # Should we pin this FROM us-west1-docker.pkg.dev/foyle-public/images/vscode as build +# Build Args need to be after the FROM stage otherwise they don't get passed through to the RUN statment +ARG VERSION=unknown +ARG DATE=unknown +ARG COMMIT=unknown + COPY /frontend/vscode/web-assets /workspace RUN /workspace/build.sh diff --git a/frontend/vscode/web-assets/build.sh b/frontend/vscode/web-assets/build.sh index 5bc269f6..5e983d43 100755 --- a/frontend/vscode/web-assets/build.sh +++ b/frontend/vscode/web-assets/build.sh @@ -12,4 +12,12 @@ rm go1.21.5.linux-amd64.tar.gz echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc cd ${DIR} -/usr/local/go/bin/go run . --vscode=/vscode --out=/assets \ No newline at end of file +/usr/local/go/bin/go run . --vscode=/vscode --out=/assets + +cat > /assets/version.json <