From f9f39738048fd09e3cc7b9194fe7739e89ef6bf8 Mon Sep 17 00:00:00 2001 From: Gesugao-san Date: Tue, 13 Feb 2024 20:32:24 +0300 Subject: [PATCH] Fix WSS --- .github/workflows/docker-publish.yml | 1 + .vscode/tasks.json | 4 ++-- Dockerfile | 9 +++++---- README.Docker.md | 4 ++-- docker-compose.yml | 7 ++++--- package.json | 2 +- vite.config.js | 8 +++++++- 7 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index b42d537..7072b72 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -19,6 +19,7 @@ env: REGISTRY: docker.io #ghcr.io # github.repository as / IMAGE_NAME: gesugaosan/proxima.fun:latest #$github.repository + WDS_SOCKET_PORT: 443 jobs: push_to_registry: diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 721b5bd..d25757f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -44,8 +44,8 @@ "image": "gesugaosan/proxima.fun", "containerName": "proxima.fun", "ports": [{ - "containerPort": 8080, - "hostPort": 8080, + "containerPort": 80, + "hostPort": 80, "protocol": "tcp", }], "env": { diff --git a/Dockerfile b/Dockerfile index de7af63..06b482e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,9 +7,10 @@ FROM node:21-alpine ### Устанавливаем кодировку. #RUN apt update && apt -y install locales && locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 +ENV WDS_SOCKET_PORT=443 ### Информация об этом пакете. LABEL name="gesugaosan/proxima.fun" @@ -53,7 +54,7 @@ RUN npm install --production --silent COPY . . ### Сообщаем Docker'у, что для работы нам нужен порт. -EXPOSE 8080:8080 +EXPOSE 80:80 ### Устанавливаем владельцем node для рабочего каталога рекурсивно. RUN chown -R node /usr/src/app diff --git a/README.Docker.md b/README.Docker.md index 5a7ae36..76e453c 100644 --- a/README.Docker.md +++ b/README.Docker.md @@ -3,7 +3,7 @@ When you're ready, start your application by running: `docker compose up --build`. -Your application will be available at http://localhost:8080. +Your application will be available at http://localhost:80. ### Deploying your application to the cloud @@ -19,4 +19,4 @@ Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharin docs for more detail on building and pushing. ### References -* [Docker's Node.js guide](https://docs.docker.com/language/nodejs/) \ No newline at end of file +* [Docker's Node.js guide](https://docs.docker.com/language/nodejs/) diff --git a/docker-compose.yml b/docker-compose.yml index 26d9800..c39d14c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,13 +17,14 @@ services: build: context: . tags: - - "latest" + - 'latest' dockerfile: ./Dockerfile environment: NODE_ENV: production + WDS_SOCKET_PORT: 443 ports: - - target: 8080 - published: 8080 + - target: 80 + published: 80 mode: host # The commented out section below is an example of how to define a PostgreSQL diff --git a/package.json b/package.json index 188a20b..2672434 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "preview": "vite preview", "dev": "vite", "docker-build": "docker build . -t \"gesugaosan/proxima.fun\"", - "docker-run": "docker run -p 8080:8080/tcp \"gesugaosan/proxima.fun\"" + "docker-run": "docker run -p 80:80/tcp \"gesugaosan/proxima.fun\"" }, "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.5.1", diff --git a/vite.config.js b/vite.config.js index f9d95b4..1cc2833 100644 --- a/vite.config.js +++ b/vite.config.js @@ -20,7 +20,13 @@ export default defineConfig({ server: { host: true, - port: 8080, + port: 80, + https: true, strictPort: true, + hmr: { + host: true, + protocol: 'wss', + clientPort: 443, + }, } })