-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
103 lines (96 loc) · 2.6 KB
/
docker-compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# docker-compose.yml
#
# Usage:
# export PORT=
# export CLOUD_RUN_SERVICE_NAME=
# export DATABASE_CLIENT=mongo
# export DATABASE_HOST=mongo
# export DATABASE_PORT=27017
# export DATABASE_NAME=strapi
# export DATABASE_USERNAME=strapi
# export DATABASE_PASSWORD=strapi
# export MONGO_INITDB_DATABASE=strapi
# export MONGO_INITDB_ROOT_USERNAME=strapi
# export MONGO_INITDB_ROOT_PASSWORD=strapi
# What can you do with this?
# Create and start all configured services with docker-compose up.
# Build your container images for local use with docker-compose build.
version: '3.9'
services:
# Backend
backend:
build:
context: ./backend
dockerfile: Dockerfile
image: strapi-backend:local
container_name: strapi-backend
#restart: unless-stopped
env_file: .env
environment:
DATABASE_CLIENT: ${DATABASE_CLIENT}
DATABASE_HOST: ${DATABASE_HOST}
DATABASE_PORT: ${DATABASE_PORT}
DATABASE_NAME: ${DATABASE_NAME}
DATABASE_USERNAME: ${DATABASE_USERNAME}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
#AUTHENTICATION_DATABASE: ${AUTHENTICATION_DATABASE}
networks:
- strapi_network
volumes:
- ./backend/app:/srv/app #It's in the Filesystem Hierarchy Standard (FHS).
ports:
- '1337:1337'
depends_on:
- strapimongo
# Frontend
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
image: strapi-frontend:local
container_name: strapi-frontend
env_file: .env
environment:
- API_BASEURL=http://localhost:1337
- NEXT_PUBLIC_API_URL=http://localhost:1337
networks:
- strapi_network
volumes:
- ./frontend/code:/srv/app # srv stands for services which require a single tree for readonly data, writable data and scripts
ports:
- '3100:3000'
depends_on:
- backend
# Database
strapimongo:
image: mongo
container_name: strapimongo
env_file: .env
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
networks:
- strapi_network
volumes:
- strapi-data:/data/db
ports:
- '27017:27017'
restart: unless-stopped
# Mongo DB Client
mongoclient:
image: mongoclient/mongoclient
container_name: strapi-mongoclient
environment:
- MONGOCLIENT_DEFAULT_CONNECTION_URL=mongodb://localhost:27017/strapi
ports:
- '3300:3000'
networks:
- strapi_network
depends_on:
- strapimongo
networks:
strapi_network:
driver: bridge
name: strapi_network
volumes:
strapi-data: