Skip to content

Commit

Permalink
docker-compose: use host networking
Browse files Browse the repository at this point in the history
  • Loading branch information
Riscky committed Feb 19, 2024
1 parent 9c9b45c commit e16035d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion INSTALLING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To get started, you will need:

- Preferably a Linux installation, but MacOS or WSL2 should work too
- Git
- Docker and docker-compose\
- Docker and docker-compose

```shell
sudo apt install git docker.io docker-compose
Expand Down
40 changes: 15 additions & 25 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,42 @@ services:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL
ports:
- '6379:6379'
volumes:
- 'redis_data:/bitnami/redis/data'
network_mode: "host"

postgres-db:
image: postgres:13
restart: always
environment:
POSTGRES_USER: koala
POSTGRES_PASSWORD: "koala123"

ports:
- "5432:5432"
network_mode: "host"

# FIXME: Koala breaks css and js when trying to connect with the
# webpack-dev-server (and failing). The connection is disabled in in
# webpack-dev-server (and failing). The connection is disabled in
# webpacker.yml for now.
webpack-dev-server:
build: .
# webpack-dev-server:
# build: .

command: [ "bundle", "exec", "./bin/webpack-dev-server" ]
# command: [ "bundle", "exec", "./bin/webpack-dev-server" ]

volumes:
- ./app:/app/app:ro
- ./bin:/app/bin:ro
# Make this directory writable inside the container, and persist changes
# accross reloads (but not on the host).
- 'webpack_data:/app/public/packs'
ports:
- 3035:3035
# volumes:
# - ./app:/app/app:ro
# - ./bin:/app/bin:ro
# # Make this directory writable inside the container.
# - ./public/packs:/app/public/packs
# network_mode: "host"

koala-development:
build: .

command: [ "rails", "server", "--binding", "0.0.0.0" ]

env_file:
- .env

depends_on:
- postgres-db
- redis
- webpack-dev-server
# - webpack-dev-server

volumes:
# Mount the sourcecode in the container, so changes end up in the
Expand All @@ -65,12 +57,10 @@ services:
- ./lib:/app/lib:ro
- ./test:/app/test:ro
- ./vendor:/app/vendor:ro
- ./.env:/app/.env:ro

ports:
- 3000:3000
network_mode: "host"

volumes:
redis_data:
driver: local
webpack_data:
driver: local
2 changes: 1 addition & 1 deletion sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Mollie, some test secrets have to be put in this file.

### Database setup ###
DATABASE_HOST=postgres-db
DATABASE_HOST=localhost
DATABASE_USER=koala
DATABASE_PASSWORD=koala123
DATABASE_PORT=5432
Expand Down

0 comments on commit e16035d

Please sign in to comment.