Fix Nginx template loading (#10)

This commit is contained in:
Veaceslav Doina 2023-12-01 10:09:20 +02:00
parent e38c66cf6a
commit db2ece4b58
No known key found for this signature in database
GPG Key ID: 351E7AA9BD0DFEB8
3 changed files with 24 additions and 16 deletions

View File

@ -27,7 +27,6 @@ ARG APP_USER
ARG APP_HOME
ARG NGINX_TEMPLATE
COPY --from=builder ${APP_HOME}/build /usr/share/nginx/html
COPY ${NGINX_TEMPLATE} /etc/nginx/nginx.template
ENTRYPOINT ["nginx", "-g", "daemon off;"]
RUN mkdir /etc/nginx/templates
COPY ${NGINX_TEMPLATE} /etc/nginx/templates/default.conf.template
COPY --chown=${APP_USER}:${APP_USER} --from=builder ${APP_HOME}/build /usr/share/nginx/html

View File

@ -1,8 +1,9 @@
:: Variables
set repository=thatbenbierens/codex-frontend
set tag=initial
set app_src=../frontend
set REPOSITORY=thatbenbierens/codex-frontend
set TAG=initial
set APP_SRC=../frontend
set NGINX_TEMPLATE=docker/nginx.template
:: Build
docker build --build-arg APP_SRC=%app_src% -t %repository%:%tag% .
docker push %repository%:%tag%
docker build --build-arg APP_SRC=%APP_SRC% --build-arg NGINX_TEMPLATE=%NGINX_TEMPLATE% -t %REPOSITORY%:%TAG% .
docker push %REPOSITORY%:%TAG%

View File

@ -1,11 +1,24 @@
server
{
log_format custom
'$remote_addr - $request_time - [$time_local] - $msec - '
'$request_id - $connection-$connection_requests - '
'$scheme - $host - $server_port - '
'$request_method - $request_uri - $server_protocol - $status - $request_completion - '
'$bytes_sent - $request_length - "$http_referer" - "$http_user_agent" - '
'$proxy_host - "$upstream_addr" - "$upstream_status" - "$upstream_connect_time" - "$upstream_response_time" ';
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
error_page 500 502 503 504 /50x.html;
access_log /var/log/nginx/access.log custom;
location / {
try_files $uri /index.html;
add_header Cache-Control "no-cache";
}
location /api {
proxy_pass $codex_url;
@ -14,9 +27,4 @@ server
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
try_files $uri /index.html;
add_header Cache-Control "no-cache";
}
}