diff --git a/.env.production b/.env.production index fceb51ee59826b1e740b20411bd4d841c719b826..b01dfd82fd8500fd3924df67119648d4555a7de3 100644 --- a/.env.production +++ b/.env.production @@ -1,5 +1,6 @@ -API_PREFIX=/api +API_BASE=backend API_PORT=8080 +API_PREFIX=/api FRONTEND_PORT=8090 VITE_FRONTEND_PORT=$FRONTEND_PORT VITE_API_PREFIX=$API_PREFIX diff --git a/Dockerfile b/Dockerfile index 67ab9c5695a6cef65ebc1191e756dccea79aea84..48e7eb0a11e82dda553070d1bb9422607f9a68ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,14 +10,16 @@ RUN npm run build -- --mode production FROM nginx:stable-alpine AS production-stage ARG FRONTEND_PORT=8090 ARG API_PORT=8080 +ARG API_BASE=backend ARG API_PREFIX=/api ENV FRONTEND_PORT=$FRONTEND_PORT +ENV API_BASE=$API_BASE ENV API_PORT=$API_PORT ENV API_PREFIX=$API_PREFIX COPY --from=build-stage /app/dist /usr/share/nginx/html COPY nginx.conf.template /etc/nginx/conf.d/default.conf.template -RUN envsubst '\$API_PORT \$FRONTEND_PORT \$API_PREFIX' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf +RUN envsubst '\$API_BASE \$API_PORT \$FRONTEND_PORT \$API_PREFIX' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf RUN cat /etc/nginx/conf.d/default.conf EXPOSE $FRONTEND_PORT CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx.conf.template b/nginx.conf.template index d907b7150b80bc66e7b577284a8fa2cd739c1b84..e3715caaab05a176acd8f177cdddedd63e3f6f15 100644 --- a/nginx.conf.template +++ b/nginx.conf.template @@ -1,5 +1,5 @@ upstream api { - server backend:${API_PORT}; + server ${API_BASE}:${API_PORT}; } server {