diff --git a/frontend/occupi-web/Dockerfile.local.dev b/frontend/occupi-web/Dockerfile.local.dev index 5ad6547d..33502965 100644 --- a/frontend/occupi-web/Dockerfile.local.dev +++ b/frontend/occupi-web/Dockerfile.local.dev @@ -17,7 +17,7 @@ COPY . . RUN npm run build # Expose the port the app runs on -EXPOSE 4001 +EXPOSE 4000 # Command to run the executable CMD ["npm", "run", "preview"] diff --git a/frontend/occupi-web/docker-compose.dev.yml b/frontend/occupi-web/docker-compose.dev.yml index 4fcf77fa..9d10a851 100644 --- a/frontend/occupi-web/docker-compose.dev.yml +++ b/frontend/occupi-web/docker-compose.dev.yml @@ -6,7 +6,7 @@ services: context: . dockerfile: Dockerfile.dev ports: - - "4001:5173" + - "4001:4173" networks: - webnet volumes: diff --git a/frontend/occupi-web/docker-compose.local.dev.yml b/frontend/occupi-web/docker-compose.local.dev.yml index 246ba594..55dfef79 100644 --- a/frontend/occupi-web/docker-compose.local.dev.yml +++ b/frontend/occupi-web/docker-compose.local.dev.yml @@ -4,7 +4,7 @@ services: container_name: occupi-web-dev build: context: . - dockerfile: Dockerfile.dev + dockerfile: Dockerfile.local.dev ports: - - "4001:5173" + - "4000:4173" restart: on-failure:5 \ No newline at end of file diff --git a/frontend/occupi-web/docker-compose.prod.yml b/frontend/occupi-web/docker-compose.prod.yml index 34c9aa07..d5351951 100644 --- a/frontend/occupi-web/docker-compose.prod.yml +++ b/frontend/occupi-web/docker-compose.prod.yml @@ -6,7 +6,7 @@ services: context: . dockerfile: Dockerfile.prod ports: - - "4000:5173" + - "4000:4173" networks: - webnet volumes: diff --git a/frontend/occupi-web/vite.config.ts b/frontend/occupi-web/vite.config.ts index 805d5d3b..95d79fe0 100644 --- a/frontend/occupi-web/vite.config.ts +++ b/frontend/occupi-web/vite.config.ts @@ -3,15 +3,13 @@ import react from "@vitejs/plugin-react"; import path from "path"; import tsconfigPaths from "vite-tsconfig-paths"; import fs from 'fs'; +import mkcert from 'vite-plugin-mkcert'; // Define paths to the certificates let keyPath = ''; let certPath = ''; -if (process.env.NODE_ENV === 'development') { - keyPath = path.resolve(__dirname, 'cert.key'); - certPath = path.resolve(__dirname, 'cert.crt'); -} else if (process.env.NODE_ENV === 'preview-dev') { +if (process.env.NODE_ENV === 'preview-dev') { keyPath = '/etc/letsencrypt/live/dev.occupi.tech/privkey.pem'; certPath = '/etc/letsencrypt/live/dev.occupi.tech/fullchain.pem'; } else if (process.env.NODE_ENV === 'preview-prod') { @@ -21,7 +19,9 @@ if (process.env.NODE_ENV === 'development') { // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react(), tsconfigPaths()], + plugins: [react(), tsconfigPaths(), mkcert({ + hosts: ['localhost', 'dev.occupi.tech', 'app.occupi.tech'], + })], resolve: { @@ -36,9 +36,11 @@ export default defineConfig({ usePolling: true, interval: 1000, // Adjust the interval if needed }, - https: process.env.NODE_ENV === 'production' ? {} : { + https: process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'preview' || process.env.NODE_ENV === 'development' ? {} : { key: fs.readFileSync(keyPath), cert: fs.readFileSync(certPath), }, + host: '0.0.0.0', + port: 4173, }, });