add docker env for integration testing
This commit is contained in:
parent
269f02c2ce
commit
0c4995db2b
6 changed files with 101 additions and 1 deletions
|
@ -207,7 +207,7 @@ CHANNEL_LAYERS = {
|
|||
'default': {
|
||||
'BACKEND': 'channels_redis.core.RedisChannelLayer',
|
||||
'CONFIG': {
|
||||
'hosts': [('localhost', 6379)],
|
||||
'hosts': [(os.getenv('REDIS_HOST', 'localhost'), 6379)],
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
REDIS_HOST=localhost
|
||||
DB_HOST=localhost
|
||||
DB_PORT=3306
|
||||
DB_NAME=c3lf_sys3
|
||||
|
|
11
deploy/testing/Dockerfile.backend
Normal file
11
deploy/testing/Dockerfile.backend
Normal file
|
@ -0,0 +1,11 @@
|
|||
FROM python:3.11-bookworm
|
||||
LABEL authors="lagertonne"
|
||||
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
RUN mkdir /code
|
||||
WORKDIR /code
|
||||
COPY requirements.prod.txt /code/
|
||||
RUN apt update && apt install -y mariadb-client
|
||||
RUN pip install -r requirements.prod.txt
|
||||
RUN pip install mysqlclient
|
||||
COPY .. /code/
|
6
deploy/testing/Dockerfile.frontend
Normal file
6
deploy/testing/Dockerfile.frontend
Normal file
|
@ -0,0 +1,6 @@
|
|||
FROM docker.io/node:22
|
||||
|
||||
RUN mkdir /web
|
||||
WORKDIR /web
|
||||
COPY package.json /web/
|
||||
RUN npm install
|
55
deploy/testing/docker-compose.yml
Normal file
55
deploy/testing/docker-compose.yml
Normal file
|
@ -0,0 +1,55 @@
|
|||
services:
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
|
||||
db:
|
||||
image: mariadb
|
||||
environment:
|
||||
MARIADB_RANDOM_ROOT_PASSWORD: true
|
||||
MARIADB_DATABASE: system3
|
||||
MARIADB_USER: system3
|
||||
MARIADB_PASSWORD: system3
|
||||
volumes:
|
||||
- mariadb_data:/var/lib/mysql
|
||||
ports:
|
||||
- "3306:3306"
|
||||
|
||||
core:
|
||||
build:
|
||||
context: ../../core
|
||||
dockerfile: ../deploy/testing/Dockerfile.backend
|
||||
command: bash -c 'python manage.py migrate && python /code/server.py'
|
||||
environment:
|
||||
- HTTP_HOST=core
|
||||
- REDIS_HOST=redis
|
||||
- DB_HOST=db
|
||||
- DB_PORT=3306
|
||||
- DB_NAME=system3
|
||||
- DB_USER=system3
|
||||
- DB_PASSWORD=system3
|
||||
volumes:
|
||||
- ../../core:/code
|
||||
ports:
|
||||
- "8000:8000"
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ../../web
|
||||
dockerfile: ../deploy/testing/Dockerfile.frontend
|
||||
command: npm run serve
|
||||
volumes:
|
||||
- ../../web:/web:ro
|
||||
- /web/node_modules
|
||||
- ./vue.config.js:/web/vue.config.js
|
||||
ports:
|
||||
- "8080:8080"
|
||||
depends_on:
|
||||
- core
|
||||
|
||||
volumes:
|
||||
mariadb_data:
|
27
deploy/testing/vue.config.js
Normal file
27
deploy/testing/vue.config.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
// vue.config.js
|
||||
|
||||
module.exports = {
|
||||
devServer: {
|
||||
headers: {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Headers": "*",
|
||||
"Access-Control-Allow-Methods": "*"
|
||||
},
|
||||
proxy: {
|
||||
'^/media/2': {
|
||||
target: 'http://core:8000/',
|
||||
},
|
||||
'^/api/2': {
|
||||
target: 'http://core:8000/',
|
||||
},
|
||||
'^/api/1': {
|
||||
target: 'http://core:8000/',
|
||||
},
|
||||
'^/ws/2': {
|
||||
target: 'http://core:8000/',
|
||||
ws: true,
|
||||
logLevel: 'debug',
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue