57 lines
1.7 KiB
YAML
57 lines
1.7 KiB
YAML
version: "3.9"
|
|
|
|
services:
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
args:
|
|
PYTHON_VERSION: "$PYTHON_VERSION"
|
|
DJANGO_VERSION: "$DJANGO_VERSION"
|
|
SELENIUM_VERSION: "$SELENIUM_VERSION"
|
|
# Note: collectstatic runs from inside the docker container and needs
|
|
# to access localstack through the host machine using host.docker.internal
|
|
# BUT when we access the django server from our host machine, we need to access
|
|
# the stored staticfiles via localhost, so export LOCALSTACK_HOST before and after
|
|
command: >
|
|
sh -c "export LOCALSTACK_HOST=host.docker.internal &&
|
|
python tests/manage.py collectstatic --no-input &&
|
|
export LOCALSTACK_HOST=localhost &&
|
|
python tests/manage.py runserver 0.0.0.0:8000"
|
|
volumes:
|
|
- .:/code
|
|
ports:
|
|
- "8000:8000"
|
|
depends_on:
|
|
- selenium
|
|
- localstack
|
|
environment:
|
|
- LOCALSTACK_HOST=host.docker.internal
|
|
- SELENIUM_HOST=host.docker.internal
|
|
|
|
selenium:
|
|
image: selenium/standalone-firefox
|
|
ports:
|
|
- "4444:4444" # Selenium
|
|
- "5900:5900" # VNC
|
|
volumes:
|
|
- .:/code
|
|
|
|
localstack:
|
|
image: localstack/localstack
|
|
ports:
|
|
- "4566:4566"
|
|
- "4571:4571"
|
|
environment:
|
|
- SERVICES=s3
|
|
- DEBUG=true
|
|
# enable persistance
|
|
- PERSISTENCE=1
|
|
- LAMBDA_EXECUTOR=docker
|
|
- DOCKER_HOST=unix:///var/run/docker.sock
|
|
- HOSTNAME_EXTERNAL=localstack
|
|
volumes:
|
|
- "./docker-entrypoint-initaws.d:/docker-entrypoint-initaws.d"
|
|
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
|
|
- "/var/run/docker.sock:/var/run/docker.sock"
|