build: add dockerfile and docker-compose file for automatically build
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
FROM python:3.9.21-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
CMD ["python3", "main.py"]
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
mongodb:
|
||||||
|
image: mongodb/mongodb-community-server
|
||||||
|
container_name: tort-mongodb
|
||||||
|
restart: always
|
||||||
|
network_mode: bridge
|
||||||
|
environment:
|
||||||
|
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER}
|
||||||
|
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASS}
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:${MONGO_PORT}:27017"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "mongosh", "--username", "${MONGO_USER}", "--password", "${MONGO_PASS}", "--eval", "db.runCommand({ ping: 1 })"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 2
|
||||||
|
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
context: ./app
|
||||||
|
image: tort-backend:latest
|
||||||
|
depends_on:
|
||||||
|
mongodb:
|
||||||
|
condition: service_healthy
|
||||||
|
container_name: tort-backend
|
||||||
|
network_mode: "host"
|
||||||
|
environment:
|
||||||
|
MONGO_HOST: ${MONGO_HOST}
|
||||||
|
MONGO_PORT: ${MONGO_PORT}
|
||||||
|
MONGO_USER: ${MONGO_USER}
|
||||||
|
MONGO_PASS: ${MONGO_PASS}
|
||||||
|
|
||||||
Reference in New Issue
Block a user