From 117011974864be2691a03b48a1118afb68a405d7 Mon Sep 17 00:00:00 2001 From: "igor.la" Date: Tue, 30 Jan 2024 12:28:58 +0300 Subject: [PATCH 1/2] Add dev config for mac --- .dockerignore | 3 ++ docker-compose.dev-mac.yml | 79 +++++++++++++++++++++++++++++++++++++ frontend/Dockerfile.mac.dev | 14 +++++++ 3 files changed, 96 insertions(+) create mode 100644 docker-compose.dev-mac.yml create mode 100644 frontend/Dockerfile.mac.dev diff --git a/.dockerignore b/.dockerignore index b8d86c1c..195b6daf 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,3 +14,6 @@ pids node_modules # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release + +./frontend/node_modules +./frontend/.nuxt diff --git a/docker-compose.dev-mac.yml b/docker-compose.dev-mac.yml new file mode 100644 index 00000000..e07b8a29 --- /dev/null +++ b/docker-compose.dev-mac.yml @@ -0,0 +1,79 @@ +x-logging: &default-logging + driver: json-file + options: + max-size: '10m' + max-file: '5' + +services: + frontend: + build: + context: . + dockerfile: ./frontend/Dockerfile.mac.dev + logging: *default-logging + ports: + - '80:80' + - '24678:24678' + depends_on: + - backend + links: + - backend + environment: + - NODE_ENV=dev + - VITE_API_URL=http://127.0.0.1/api + - VITE_BASE_URL=http://127.0.0.1 + - VITE_IPREGISTRY_API_KEY=ryy5dlbl3v8y55x4 + - VITE_MODE=development + - VITE_TELEGRAM_AUTH_BOT_NAME=afisha_oauth_local_bot + develop: + watch: + # sync static content + - path: ./frontend + action: sync + target: /app/frontend + ignore: + - node_modules/ + - path: ./frontend/package.json + action: rebuild + - path: ./frontend/i18n + action: rebuild + - path: ./frontend/Dockerfile.mac.dev + action: rebuild + + backend: + build: + context: . + dockerfile: ./backend/Dockerfile.win.dev + logging: *default-logging + depends_on: + - mongo + links: + - mongo + environment: + - MODE=dev + - FRONTEND_URL=http://127.0.0.1 + - MONGO_URI=mongodb://mongo:27017/dev + ports: + - '7080:7080' + develop: + watch: + # sync static content + - path: ./backend + action: sync + target: /app/backend + ignore: + - node_modules/ + - path: ./backend/package.json + action: rebuild + + mongo: + image: mongo:6.0 + restart: unless-stopped + command: ['--bind_ip_all'] + healthcheck: + test: test $$(echo "rs.initiate().ok || rs.status().ok" | mongo --quiet) -eq 1 + interval: 10s + start_period: 30s + ports: + - '27020:27017' + volumes: + - /tmp/ows-events/db:/data/db diff --git a/frontend/Dockerfile.mac.dev b/frontend/Dockerfile.mac.dev new file mode 100644 index 00000000..42378b72 --- /dev/null +++ b/frontend/Dockerfile.mac.dev @@ -0,0 +1,14 @@ +FROM node:18-alpine + +WORKDIR /app +COPY ./frontend ./frontend +COPY ./common ./common +ENV NUXT_HOST=0.0.0.0 +ENV NUXT_PORT=80 + +EXPOSE 80 +EXPOSE 24678 + +WORKDIR /app/frontend +RUN npm install +ENTRYPOINT ["npm", "run", "dev"] From f4e90f6a52176d365d80c15cd10eb493faf32342 Mon Sep 17 00:00:00 2001 From: "igor.la" Date: Tue, 30 Jan 2024 12:45:01 +0300 Subject: [PATCH 2/2] Fix container network --- docker-compose.dev-mac.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.dev-mac.yml b/docker-compose.dev-mac.yml index e07b8a29..bfc78cba 100644 --- a/docker-compose.dev-mac.yml +++ b/docker-compose.dev-mac.yml @@ -19,8 +19,8 @@ services: - backend environment: - NODE_ENV=dev - - VITE_API_URL=http://127.0.0.1/api - - VITE_BASE_URL=http://127.0.0.1 + - VITE_API_URL=http://backend/api + - VITE_BASE_URL=http://backend - VITE_IPREGISTRY_API_KEY=ryy5dlbl3v8y55x4 - VITE_MODE=development - VITE_TELEGRAM_AUTH_BOT_NAME=afisha_oauth_local_bot