diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..52ff479 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +# .dockerignore +node_modules/ +.git/ +.DS_Store +docker-compose.yml +*.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3bdc754 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +#FROM node:20 AS build + +#WORKDIR /app + +#COPY package.json package-lock.json ./ + +#RUN npm install + +#COPY . . + +#RUN npm run build + +FROM nginx:alpine + +#COPY --from=build /app/build /usr/share/nginx/html + +COPY ./dist /usr/share/nginx/html + +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..3ab8290 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,36 @@ +server { + listen 80; + server_name aypos.blc-css.com; # Replace with your domain or IP + + root /usr/share/nginx/html; # Path to your built files + index index.html; + + # Serve static files directly + location / { + try_files $uri $uri/ /index.html; + } + + location /api/ { + proxy_pass http://aypos-api.blc-css.com:8003/; # Proxy to your API subdomain + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + # Optional: Add gzip compression for better performance + gzip on; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + # Optional: Add security headers (adjust as needed) + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-Content-Type-Options "nosniff"; + + # Optional: Cache static assets aggressively + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + expires 1y; + access_log off; + add_header Cache-Control "public"; + try_files $uri =404; + } +}