You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the GitHub search to find a similar question and didn't find it.
I searched in the documentation/README.
I already searched in Google "How to do X" and didn't find any information.
I already read and followed all the tutorial in the docs/README and didn't find an answer.
Commit to Help
I commit to help with one of those options 👆
Example Code
# Dockerfile for frontend:
# Stage 0, "build-stage", based on Node.js, to build and compile the frontend
FROM node:20 AS build-stage
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY ./ /app/
ARG VITE_API_URL=${VITE_API_URL}
# Add build time information
RUN date '+%Y-%m-%d %H:%M:%S %Z' > /app/public/build-time.txt
RUN npm run build
# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1
COPY --from=build-stage /app/dist/ /usr/share/nginx/html
# Copy build time information to nginx
COPY --from=build-stage /app/public/build-time.txt /usr/share/nginx/html/build-time.txt
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY ./nginx-backend-not-found.conf /etc/nginx/extra-conf.d/backend-not-found.conf
Description
I need to include build-related information (commit hash, release tag if there is any, build time, etc) either embedded in the frontend or backend so that I can check which release the issue is happening on if present, either with sentry or manually.
I found this post on StackOverflow that writes output from git rev-parse HEAD to a file, which looks promising but I am struggling to find where in the deployment stage to put it that makes sense.
I have tried putting it in the frontend Dockerfile like the above command, but since when the container is being built, the context is set to the frontend folder, which prevents git command from getting any info; The next option is to put it in GitHub deploy workflows, but then I won't have those info in my local dev env, which is not a huge deal, but I still wonder if there is a better way of doing it that makes it work everywhere.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
I need to include build-related information (commit hash, release tag if there is any, build time, etc) either embedded in the frontend or backend so that I can check which release the issue is happening on if present, either with sentry or manually.
I found this post on StackOverflow that writes output from
git rev-parse HEAD
to a file, which looks promising but I am struggling to find where in the deployment stage to put it that makes sense.I have tried putting it in the frontend Dockerfile like the above command, but since when the container is being built, the context is set to the frontend folder, which prevents git command from getting any info; The next option is to put it in GitHub deploy workflows, but then I won't have those info in my local dev env, which is not a huge deal, but I still wonder if there is a better way of doing it that makes it work everywhere.
Thanks!
Operating System
Windows
Operating System Details
Not applicable
Python Version
Python 3.12.2
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions