Skip to content

Commit 255ea93

Browse files
committed
Pass in Application Version during build
1 parent bcc7d74 commit 255ea93

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
FROM node:22-alpine AS builder
2+
23
EXPOSE 8080
34

45
WORKDIR /app
56
COPY package.json package-lock.json ./
67
RUN npm install --no-cache
78
COPY . .
89
RUN chmod +x build.sh
9-
RUN ./build.sh
1010

11+
RUN ./build.sh
1112

1213
FROM nginx:stable-alpine AS final
1314

15+
ARG APPLICATION_VERSION
1416
COPY deployment/nginx.conf /etc/nginx/nginx.conf
1517
COPY deployment/default.conf /etc/nginx/conf.d/default.conf
18+
RUN sed -i "s|\$APPLICATION_VERSION|${APPLICATION_VERSION}|g" /etc/nginx/conf.d/default.conf
1619
COPY --from=builder --chown=nginx:nginx /app/root/redirect.conf /etc/nginx/extra/redirect.conf
1720

1821
RUN rm -rf /usr/share/nginx/html/*

deployment/default.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ server {
55
location / {
66
root /usr/share/nginx/html;
77
index index.html index.htm;
8+
add_header X-REVISION $APPLICATION_VERSION;
89
}
910
include /etc/nginx/extra/*.conf;
1011

0 commit comments

Comments
 (0)