1
0
Pārlūkot izejas kodu

enable configurable api host on deploy

Aneurin Barker Snook 11 mēneši atpakaļ
vecāks
revīzija
0ce0700da6
3 mainītis faili ar 19 papildinājumiem un 0 dzēšanām
  1. 9 0
      Dockerfile
  2. 5 0
      docker/config.json
  3. 5 0
      docker/entrypoint.sh

+ 9 - 0
Dockerfile

@@ -28,6 +28,11 @@ RUN npm run build
 
 FROM node:20
 
+ARG VITE_API_HOST=http://localhost:5001
+ENV VITE_API_HOST $VITE_API_HOST
+
+RUN apt update && apt install -y gettext
+
 WORKDIR /app
 
 COPY LICENSE.md package-lock.json package.json ./
@@ -35,4 +40,8 @@ COPY --from=build_server /app/out ./out
 COPY --from=build_server /app/node_modules ./node_modules
 COPY --from=build_web /web/dist ./out/public
 
+COPY docker /docker
+RUN chmod +x /docker/entrypoint.sh
+
+ENTRYPOINT ["/docker/entrypoint.sh"]
 CMD ["npm", "start"]

+ 5 - 0
docker/config.json

@@ -0,0 +1,5 @@
+{
+  "api": {
+    "host": "${VITE_API_HOST}"
+  }
+}

+ 5 - 0
docker/entrypoint.sh

@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+envsubst < /docker/config.json > /app/out/public/config.json
+
+exec "$@"