Use custom Nginx config (#58)

* Add custom Nginx config (#53)

* Use custom Nginx config (#53)
This commit is contained in:
Slava 2024-10-18 14:00:24 +03:00 committed by GitHub
parent bd3cc1cc4e
commit 11b44ce8be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 1 deletions

View File

@ -4,7 +4,8 @@ ARG IMAGE=nginx:1.27-alpine-slim
ARG APP_USER=root ARG APP_USER=root
ARG BUILD_HOME=/app ARG BUILD_HOME=/app
ARG BUILD_OUT=dist ARG BUILD_OUT=dist
ARG APP_HOME=/usr/share/nginx/html ARG APP_HOME=${BUILD_HOME}
ARG NGINX_TEMPLATE=docker/default.conf.template
ARG VITE_CODEX_API_URL=${VITE_CODEX_API_URL:-http://127.0.0.1:8080} ARG VITE_CODEX_API_URL=${VITE_CODEX_API_URL:-http://127.0.0.1:8080}
ARG VITE_GEO_IP_URL=${VITE_GEO_IP_URL:-http://127.0.0.1:8080} ARG VITE_GEO_IP_URL=${VITE_GEO_IP_URL:-http://127.0.0.1:8080}
@ -31,8 +32,13 @@ ARG APP_USER
ARG BUILD_HOME ARG BUILD_HOME
ARG BUILD_OUT ARG BUILD_OUT
ARG APP_HOME ARG APP_HOME
ARG NGINX_TEMPLATE
WORKDIR ${APP_HOME} WORKDIR ${APP_HOME}
RUN mkdir /etc/nginx/templates
COPY ${NGINX_TEMPLATE} /etc/nginx/templates
COPY --chown=${APP_USER}:${APP_USER} --from=builder ${BUILD_HOME}/${BUILD_OUT} . COPY --chown=${APP_USER}:${APP_USER} --from=builder ${BUILD_HOME}/${BUILD_OUT} .
ENV APP_HOME=${APP_HOME}
EXPOSE 80 EXPOSE 80

View File

@ -0,0 +1,15 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
error_page 500 502 503 504 /50x.html;
location / {
root ${APP_HOME};
index index.html;
try_files $uri $uri/ /index.html =404;
}
}