-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
137 lines (125 loc) · 3.56 KB
/
docker-compose.dev.yml
File metadata and controls
137 lines (125 loc) · 3.56 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# This docker-compose file sets up the dev environment.
# It builds an app container based on Dockerfile.chemotion.dev
#
# USAGE:
# The docker compose command should be apply with the following args
# docker compose -f docker-compose.dev.yml --env-file .dockerenv
#
# docker_cmd="docker compose -f docker-compose.dev.yml --env-file .dockerenv "
#
# - Build the dev image with mapping to the current user and group ids:
# gid=$(id -g) uid=$(id -u) ${docker_cmd} build setup
#
# - Run development environment:
# ${docker_cmd} up -d
#
# - Open a bash shell in the app container:
# ${docker_cmd} app bash
#
# - Run tests:
# ${docker_cmd} app bundle exec rspec
# ${docker_cmd} app yarn test
#
# - see .dockerenv.example for environment variables usage
#
x-common-volumes: &common-volumes
- homedir:/home/ubuntu
- .:/home/ubuntu/app
x-common-build: &common-build
context: '.'
dockerfile: 'Dockerfile.chemotion-dev'
args:
uid: ${uid:-default}
gid: ${gid:-default}
x-common-image:
- &chemotion_eln_dev ${DOCKER_DEV_IMAGE:-chemotion_eln_dev}
services:
setup:
build: *common-build
image: *chemotion_eln_dev
volumes: *common-volumes
working_dir: "/home/ubuntu/app"
command: "./prepare-ruby-dev.sh"
postgres:
image: ${DOCKER_PG_IMAGE:-postgres:16}
environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust'
expose: # expose port to app container
- '5432'
ports: # expose port to host machine in case we want to use external db gui tools
- ${HOST_PORT_PG:-5432}:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
volumes:
- database:/var/lib/postgresql/data
app:
image: *chemotion_eln_dev
depends_on:
setup:
condition: service_completed_successfully
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "bundle", "check"] # exit 0 if all gems from Gemfile are installed, otherwise exit 1
interval: 30s
timeout: 10s
env_file:
- .env
environment:
- 'SHAKAPACKER_DEV_SERVER_HOST=webpacker'
- 'SHAKAPACKER_DEV_SERVER_PORT=3035'
- 'THOR_SILENCE_DEPRECATION=true'
- RAKE_DB_MIGRATE=${RAKE_DB_MIGRATE:-never}
ports: # expose default rails port to host machine
- ${HOST_PORT_APP:-3000}:3000
volumes: *common-volumes
working_dir: "/home/ubuntu/app"
command: "./run-ruby-dev.sh"
networks:
- default
- chemotion
webpacker:
image: *chemotion_eln_dev
depends_on:
setup:
condition: service_completed_successfully
app:
condition: service_healthy
environment:
- 'NODE_ENV=development'
- 'SHAKAPACKER_DEV_SERVER_HOST=webpacker'
- 'SHAKAPACKER_DEV_SERVER_PORT=3035'
env_file:
- .env
# - .env.development
volumes: *common-volumes
ports: # expose webpacker dev server port to app container
- ${HOST_PORT_WEBPACK:-3035}:3035
expose:
- '3035'
working_dir: "/home/ubuntu/app"
command: './run-js-dev.sh'
storybook:
depends_on:
webpacker:
condition: service_started
image: *chemotion_eln_dev
env_file:
- ./.env
#- ./.env.development
volumes: *common-volumes
ports: # expose storybook dev server port to host machine
- "6006:6006"
working_dir: "/home/ubuntu/app"
command: 'yarn run storybook'
volumes:
database:
name: ${VOLUME_NAME_DB:-chemotion_eln_database}
homedir:
name: ${VOLUME_NAME_HOMEDIR:-chemotion_eln_homedir}
networks:
chemotion: