Skip to content

Commit 4a34ca0

Browse files
committed
front: fill git describe using vite instead of import-meta-env
Signed-off-by: Florian Amsallem <florian.amsallem@gmail.com>
1 parent 32128d8 commit 4a34ca0

12 files changed

+54
-165
lines changed

docker-compose.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ services:
6868
additional_contexts:
6969
test_data: tests/data
7070
static_assets: assets
71+
args:
72+
OSRD_GIT_DESCRIBE: development
7173
environment:
7274
# Actual values in ./docker/osrdyne.yml (please maintain consistency)
7375
# Provided here only for reuse in compose layers and doc
@@ -90,7 +92,7 @@ services:
9092
test_data: tests/data
9193
dockerfile: docker/Dockerfile.${OSRD_FRONT_MODE-devel}
9294
args:
93-
OSRD_GIT_DESCRIBE: ${OSRD_GIT_DESCRIBE}
95+
OSRD_GIT_DESCRIBE: development
9496
environment:
9597
FRONT_PORT: 3000 # only useful with the prod config
9698
OSRD_EDITOAST_URL: /api
@@ -120,6 +122,7 @@ services:
120122
static_assets: assets
121123
args:
122124
CARGO_PROFILE: dev
125+
OSRD_GIT_DESCRIBE: development
123126
restart: unless-stopped
124127
ports: [ "8090:80" ]
125128
environment:

front/.env.example

-1
This file was deleted.

front/docker/Dockerfile.devel

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ COPY --from=exec_as_builder /exec-as /
1616

1717
WORKDIR /app
1818

19+
# Fill build time values
20+
ARG OSRD_GIT_DESCRIBE
21+
ENV VITE_OSRD_GIT_DESCRIBE=${OSRD_GIT_DESCRIBE}
22+
1923
# Start the app
2024
COPY docker/dev-entrypoint.sh /
2125
ENTRYPOINT ["/dev-entrypoint.sh"]

front/docker/Dockerfile.nginx

+6-9
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ FROM node:20-bookworm AS build
44

55
WORKDIR /app
66

7+
78
# Build dependencies
89
COPY package.json package-lock.json /app/
910
RUN npm install --frozen-lockfile
1011

12+
# Fill build time values
13+
ARG OSRD_GIT_DESCRIBE
14+
ENV VITE_OSRD_GIT_DESCRIBE=${OSRD_GIT_DESCRIBE}
15+
1116
# Generate the licenses file and build
1217
COPY . /app
1318
RUN npm run generate-licenses && npm run build
@@ -23,18 +28,10 @@ COPY --from=test_data . /tests/data
2328

2429
FROM nginx:alpine
2530

26-
RUN apk add npm && \
27-
npm install -g @import-meta-env/cli && \
28-
rm /etc/nginx/conf.d/default.conf
29-
3031
COPY docker/nginx.conf /etc/nginx/conf.d
3132
COPY docker/nginx-entrypoint.sh /entrypoint.sh
3233

3334
COPY --from=build /app/build /srv
34-
COPY --from=build /app/.env.example /
35-
36-
ARG OSRD_GIT_DESCRIBE
37-
ENV OSRD_GIT_DESCRIBE=${OSRD_GIT_DESCRIBE}
3835

3936
ENTRYPOINT ["/entrypoint.sh"]
40-
CMD ["sh", "-c", "npx import-meta-env -x /.env.example -p /srv/index.html && exec nginx -g 'daemon off;'"]
37+
CMD ["nginx", "-g", "daemon off"]

0 commit comments

Comments
 (0)