Skip to content

Commit

Permalink
Complete research for HMR fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gesugao-san committed Feb 13, 2024
1 parent 0749673 commit 09f6978
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 19 deletions.
8 changes: 6 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@
"image": "gesugaosan/proxima.fun",
"containerName": "proxima.fun",
"ports": [{
"containerPort": 8080,
"hostPort": 8080,
"containerPort": 80,
"hostPort": 80,
"protocol": "tcp",
},{
"containerPort": 443,
"hostPort": 443,
"protocol": "tcp",
}],
"env": {
Expand Down
27 changes: 20 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ ENV NODE_ENV=production
WORKDIR /usr/src/app

### Копируем файлы (при наличии).
COPY [\
"package.json", \
"package-lock.json*", \
"npm-shrinkwrap.json*", \
"./"\
]
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]

### Устанавливаем зависимости проекта.
#RUN apt-get update && apt-get install -y nodejs npm && rm -rf /var/lib/apt/lists/*
Expand All @@ -54,7 +49,25 @@ RUN npm install --production --silent
COPY . .

### Сообщаем Docker'у, что для работы нам нужен порт.
EXPOSE 8080:8080

### HTTP (1)
EXPOSE 80:80/tcp

### HTTP (2)
#EXPOSE 8080:8080/tcp

### WebSocket
EXPOSE 443:443/tcp

#
#EXPOSE 3001:3000/tcp
#EXPOSE 3000:3000/tcp

### Vite ver. 5 default
#EXPOSE 5173:5173/tcp

### Vite (ver. <5) default
#EXPOSE 24678:24678/tcp

### Устанавливаем владельцем node для рабочего каталога рекурсивно.
RUN chown -R node /usr/src/app
Expand Down
17 changes: 14 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# database or a cache. For examples, see the Awesome Compose repository:
# https://github.com/docker/awesome-compose

version: '3.4'
version: '3.8'
#name: proxima-fun

services:
Expand All @@ -23,9 +23,20 @@ services:
NODE_ENV: production
WDS_SOCKET_PORT: 443
ports:
- target: 8080
published: 8080
- target: 80
published: 80
protocol: tcp
mode: host
- target: 443
published: 443
protocol: tcp
mode: host
#- 80:80
#- 8080:8080
#- 443:443
#- 3001:3000
#- 5173:5173
#- 24678:24678

# The commented out section below is an example of how to define a PostgreSQL
# database that your application can use. `depends_on` tells Docker Compose to
Expand Down
27 changes: 20 additions & 7 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,28 @@ export default defineConfig({
}
},

clearScreen: false,
server: {
host: true,
port: 8080,
https: false,
strictPort: true,
host: '0.0.0.0', // OK
//host: true, // OK
//host: 'localhost', // NOT FOR PUBLIC
//port: 8080, // CRITICAL
port: 80, // CRITICAL
clientPort: 80,
//https: false, // UNKNOWN
strictPort: true, // OK
//hmr: false
hmr: {
host: true,
protocol: 'wss',
clientPort: 443,
//host: 'localhost', // CRITICAL, OK
//host: true, // LOOP
//host: '0.0.0.0', // LOOP
//protocol: 'ws', // OK
//protocol: 'wss', // LOOP
port: 443, // OK
//Port: 443, // OK
//port: 3000,
//clientPort: 3001,
clientPort: 443, // LOOP
},
}
})

0 comments on commit 09f6978

Please sign in to comment.