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..bfc78cba --- /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://backend/api + - VITE_BASE_URL=http://backend + - 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"]