From 6fa3a72bb18c66bc2b6891a55cfaad7e46f59941 Mon Sep 17 00:00:00 2001 From: "Felix T.J. Dietrich" Date: Wed, 14 Aug 2024 10:46:10 +0200 Subject: [PATCH] fix SPA routing --- webapp/Dockerfile | 5 +++++ webapp/nginx.conf | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 webapp/nginx.conf diff --git a/webapp/Dockerfile b/webapp/Dockerfile index e0ab5202..eadf5da8 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -4,6 +4,9 @@ WORKDIR /app COPY ./ /app/ +# Ensure .env file exists +RUN touch .env + # Fix buggy replacement of COOLIFY_URL in .env RUN COOLIFY_URL_VALUE=$(grep '^COOLIFY_URL=' .env | cut -d '=' -f2) && \ sed -i "s|\$COOLIFY_URL|$COOLIFY_URL_VALUE|g" .env @@ -20,4 +23,6 @@ FROM nginx:latest COPY --from=build /app/dist/webapp/browser /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf + EXPOSE 80 diff --git a/webapp/nginx.conf b/webapp/nginx.conf new file mode 100644 index 00000000..439c0cde --- /dev/null +++ b/webapp/nginx.conf @@ -0,0 +1,11 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html; + try_files $uri $uri/ /index.html =404; + } +}