push
This commit is contained in:
11
web-client/.dockerignore
Normal file
11
web-client/.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
||||
node_modules
|
||||
dist
|
||||
.env
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
.DS_Store
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
@@ -1,4 +1,10 @@
|
||||
# Leave empty in local dev to use Vite proxy: /api -> PACKAGE_PROXY_TARGET.
|
||||
WEB_CLIENT_IMAGE_REPOSITORY=toiiiiday/robot-installer-web-client
|
||||
WEB_CLIENT_CONTAINER_NAME=robot-installer-web-client
|
||||
WEB_CLIENT_PORT=8080
|
||||
IMAGE_TAG=1.0.1
|
||||
DOCKER_NETWORK=robot-installer-net
|
||||
PACKAGE_PROXY_TARGET=http://robot-installer-web-server:3000
|
||||
|
||||
VITE_PACKAGE_BASE_URL=
|
||||
VITE_AGENT_BASE_URL=http://127.0.0.1:5010
|
||||
PACKAGE_PROXY_TARGET=http://localhost:3000
|
||||
|
||||
27
web-client/Dockerfile
Normal file
27
web-client/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM node:22-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
|
||||
ARG VITE_PACKAGE_BASE_URL=
|
||||
ARG VITE_AGENT_BASE_URL=http://127.0.0.1:5010
|
||||
|
||||
RUN VITE_PACKAGE_BASE_URL="${VITE_PACKAGE_BASE_URL}" \
|
||||
VITE_AGENT_BASE_URL="${VITE_AGENT_BASE_URL}" \
|
||||
npm run build
|
||||
|
||||
FROM nginx:1.27-alpine AS runtime
|
||||
|
||||
ENV PACKAGE_PROXY_TARGET=http://web-server:3000
|
||||
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD wget -qO- http://127.0.0.1/ >/dev/null || exit 1
|
||||
21
web-client/docker-compose.yml
Normal file
21
web-client/docker-compose.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
services:
|
||||
web-client:
|
||||
image: ${WEB_CLIENT_IMAGE_REPOSITORY:-robot-installer-web-client}:${IMAGE_TAG:-local}
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
VITE_PACKAGE_BASE_URL: ${VITE_PACKAGE_BASE_URL:-}
|
||||
VITE_AGENT_BASE_URL: ${VITE_AGENT_BASE_URL:-http://127.0.0.1:5010}
|
||||
container_name: ${WEB_CLIENT_CONTAINER_NAME:-robot-installer-web-client}
|
||||
environment:
|
||||
PACKAGE_PROXY_TARGET: ${PACKAGE_PROXY_TARGET:-http://robot-installer-web-server:3000}
|
||||
ports:
|
||||
- "${WEB_CLIENT_PORT:-8080}:80"
|
||||
networks:
|
||||
- robot-installer
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
robot-installer:
|
||||
name: ${DOCKER_NETWORK:-robot-installer-net}
|
||||
external: true
|
||||
58
web-client/nginx.conf.template
Normal file
58
web-client/nginx.conf.template
Normal file
@@ -0,0 +1,58 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
client_max_body_size 1024m;
|
||||
|
||||
location = /api {
|
||||
proxy_pass ${PACKAGE_PROXY_TARGET};
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location ^~ /api/ {
|
||||
proxy_pass ${PACKAGE_PROXY_TARGET};
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location = /install-agent.sh {
|
||||
proxy_pass ${PACKAGE_PROXY_TARGET};
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location ^~ /uploads/ {
|
||||
proxy_pass ${PACKAGE_PROXY_TARGET};
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location ^~ /packages/ {
|
||||
proxy_pass ${PACKAGE_PROXY_TARGET};
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user