diff --git a/docker-compose.yml b/docker-compose.yml index e15b74e7..d824f268 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,17 @@ version: '3' + services: wise-api: + container_name: wise-api + image: wise-api:latest build: context: ./wise-api dockerfile: Dockerfile ports: - "8080:8080" -# environment: -# SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/product -# SPRING_DATASOURCE_USERNAME: product_user -# SPRING_DATASOURCE_PASSWORD: product_user_password - - react-app: + wise-ui: + container_name: wise-ui + image: wise-ui:latest build: context: ./wise-ui dockerfile: Dockerfile diff --git a/wise-ui/Dockerfile b/wise-ui/Dockerfile index f5a432a5..df3f72e2 100644 --- a/wise-ui/Dockerfile +++ b/wise-ui/Dockerfile @@ -11,14 +11,17 @@ RUN mkdir mindplot && npm pack @wisemapping/mindplot@${VERSION} && tar -xvzf wis ADD index.html . # Use Nginx as the production server -FROM nginx:stable-alpine +FROM nginx:latest LABEL maintainer="Paulo Gustavo Veiga " ## Copy the built React app to Nginx's web server directory -COPY --from=builder /app /usr/share/nginx/html +COPY --from=builder /app/index.html /usr/share/nginx/html/ COPY --from=builder /app/webapp/package/dist/* /usr/share/nginx/html/webapp/ COPY --from=builder /app/mindplot/package/dist/* /usr/share/nginx/html/mindplot/ +ADD nginx.conf . +COPY nginx.conf /etc/nginx/conf.d/default.conf + # Expose port 80 for the Nginx server EXPOSE 80 diff --git a/wise-ui/nginx.conf b/wise-ui/nginx.conf new file mode 100644 index 00000000..75d549c6 --- /dev/null +++ b/wise-ui/nginx.conf @@ -0,0 +1,27 @@ +server { + listen 80; + gzip on; + charset UTF-8; + server_name wise-ui; + + location / { + # This would be the directory where your React app's static files are stored at + root /usr/share/nginx/html; + try_files $uri /index.html; + } + + location /c/ { + try_files $uri /usr/share/nginx/html/index.html; + } + + location /api/ { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://localhost:8080/api/; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_cache_bypass $http_upgrade; + proxy_redirect off; + } +}