mirror of
https://github.com/twofas/2fas-server.git
synced 2024-11-22 02:10:38 +01:00
1413d107b3
Prepare to deploy service
101 lines
2.1 KiB
YAML
101 lines
2.1 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/api/Dockerfile
|
|
depends_on:
|
|
shared-volume-init:
|
|
condition: service_completed_successfully
|
|
mysql:
|
|
condition: service_healthy
|
|
group_add:
|
|
- '1000'
|
|
volumes:
|
|
- ./migrations:/migrations
|
|
- go-modules:/go/pkg/mod
|
|
- shared-volume:/tmp/2fas
|
|
ports:
|
|
- "80:8080"
|
|
env_file:
|
|
- .env
|
|
|
|
admin:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/admin/Dockerfile
|
|
depends_on:
|
|
shared-volume-init:
|
|
condition: service_completed_successfully
|
|
mysql:
|
|
condition: service_healthy
|
|
group_add:
|
|
- '1000'
|
|
volumes:
|
|
- shared-volume:/tmp/2fas
|
|
ports:
|
|
- "8082:8080"
|
|
env_file:
|
|
- .env
|
|
|
|
websocket:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/websocket/Dockerfile
|
|
depends_on:
|
|
- mysql
|
|
ports:
|
|
- "8081:8081"
|
|
env_file:
|
|
- .env
|
|
|
|
mysql:
|
|
image: mysql:8
|
|
volumes:
|
|
- ./data/mysql:/var/lib/mysql
|
|
- ./docker/mysql/dev-schema.sql:/docker-entrypoint-initdb.d/schema.sql
|
|
ports:
|
|
- "127.0.0.1:3306:3306"
|
|
environment:
|
|
- MYSQL_ROOT_PASSWORD=root
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
|
|
timeout: 20s
|
|
retries: 10
|
|
|
|
redis:
|
|
image: bitnami/redis:latest
|
|
ports:
|
|
- "127.0.0.1:6379:6379"
|
|
environment:
|
|
- ALLOW_EMPTY_PASSWORD=yes
|
|
|
|
# docker compose always mount named volumes as root (https://github.com/docker/compose/issues/3270)
|
|
# and without changing permission, we want be able to access shared volume
|
|
shared-volume-init:
|
|
image: ubuntu
|
|
user: root
|
|
group_add:
|
|
- '1000'
|
|
volumes:
|
|
- shared-volume:/tmp/2fas
|
|
command: chown -R 1000:1000 /tmp/2fas
|
|
|
|
pass:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/pass/Dockerfile
|
|
group_add:
|
|
- '1000'
|
|
ports:
|
|
- "8084:8082"
|
|
env_file:
|
|
- .env
|
|
|
|
volumes:
|
|
go-modules:
|
|
# shared-volume is used to share volume between api and admin. On producition AWS S3 is used,
|
|
# but here for local dev shared volume is fine.
|
|
shared-volume:
|