[Docker] Add test service

This can simply be invoced with `docker-compose run tests`.
This commit is contained in:
Earlopain 2022-03-28 16:18:07 +02:00
parent a7f129100e
commit 5180d313ef
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897

View File

@ -1,25 +1,27 @@
version: "3"
x-environment: &common-env
DATABASE_URL: postgresql://danbooru:@postgres
DANBOORU_HOSTNAME: http://localhost:3000
DANBOORU_REDIS_URL: redis://redis
DANBOORU_ELASTICSEARCH_HOST: elastic
DANBOORU_MEMCACHED_SERVERS: memcached
# These are just development secrets, do not use them in production
SECRET_TOKEN: 1c58518a891eff4520cadc59afa9e378a9325f1247544ff258096e497f095f45
SESSION_SECRET_KEY: 44b4f44e9f253c406cbe727d403d500c1cecff943e4d2aea8f5447f28846fffe
services:
e621:
build: ./
image: e621
volumes:
- .:/app
- node_modules:/app/node_modules
- public_packs:/app/public/packs
- public_packs_test:/app/public/packs-test
- post_data:/app/public/data
environment:
DATABASE_URL: postgresql://danbooru:@postgres
<<: *common-env
RAILS_ENV: development
DANBOORU_HOSTNAME: http://localhost:3000
DANBOORU_REDIS_URL: redis://redis
DANBOORU_ELASTICSEARCH_HOST: elastic
DANBOORU_MEMCACHED_SERVERS: memcached
DANBOORU_IQDBS_SERVER: http://iqdb:4567
# These are just development secrets, do not use them in production
SECRET_TOKEN: 1c58518a891eff4520cadc59afa9e378a9325f1247544ff258096e497f095f45
SESSION_SECRET_KEY: 44b4f44e9f253c406cbe727d403d500c1cecff943e4d2aea8f5447f28846fffe
depends_on:
- postgres
- redis
@ -28,13 +30,30 @@ services:
- iqdb
tty: true
tests:
image: e621
environment:
<<: *common-env
# Hide annoying output from libvips on corrupt files
VIPS_WARNING: "0"
volumes:
- .:/app
- node_modules:/app/node_modules
depends_on:
- postgres
- redis
- memcached
- elastic
entrypoint: ["bundle", "exec", "rails", "test"]
profiles:
- test
nginx:
image: nginx:stable-alpine
volumes:
- ./public:/app/public
- post_data:/app/public/data
- public_packs:/app/public/packs
- public_packs_test:/app/public/packs-test
- ./docker/default.conf.template:/etc/nginx/templates/default.conf.template
environment:
NGINX_HOST: localhost