diff --git a/app/dockerfile b/app/dockerfile new file mode 100644 index 0000000..281fd13 --- /dev/null +++ b/app/dockerfile @@ -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"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c21f383 --- /dev/null +++ b/docker-compose.yml @@ -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} +