diff --git a/docker/docker-compose.prod.render.yml b/docker/docker-compose.prod.render.yml new file mode 100644 index 000000000..74457f5ac --- /dev/null +++ b/docker/docker-compose.prod.render.yml @@ -0,0 +1,40 @@ +services: + + web: + container_name: web_app_container + image: drorganvidez/uvlhub:latest + build: + context: ../ + dockerfile: docker/images/Dockerfile.render + ports: + - "5000:5000" + restart: always + volumes: + - ./entrypoints/production_entrypoint.sh:/app/entrypoint.sh + - ../scripts:/app/scripts + - ../migrations:/app/migrations + command: [ "sh", "-c", "sh /app/entrypoint.sh" ] + + db: + container_name: mariadb_container + image: mariadb:latest + command: --default-authentication-plugin=mysql_native_password + restart: always + ports: + - "3306:3306" + volumes: + - db_data:/var/lib/mysql + + nginx: + container_name: nginx_web_server_container + image: nginx:latest + volumes: + - type: bind + source: nginx/nginx.prod.conf + target: /etc/nginx/nginx.conf + ports: + - "80:80" + restart: always + +volumes: + db_data: \ No newline at end of file diff --git a/docker/images/Dockerfile.render b/docker/images/Dockerfile.render new file mode 100644 index 000000000..9b18281e2 --- /dev/null +++ b/docker/images/Dockerfile.render @@ -0,0 +1,29 @@ +# Use an official Python runtime as a parent image, Alpine version for a lighter footprint +FROM python:3.12-alpine + +# Install MySQL client and temporary build dependencies +RUN apk add --no-cache mysql-client \ + && apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev libffi-dev openssl-dev + +# Set the working directory in the container to /app +WORKDIR /app + +# Copy files +COPY app/ ./app +COPY core/ ./core +COPY migrations/ ./migrations + +# Copy requirements.txt into the working directory /app +COPY requirements.txt . + +# Copy the wait-for-db.sh script and set execution permissions +COPY --chmod=+x scripts/wait-for-db.sh ./scripts/ + +# Install any needed packages specified in requirements.txt and upgrade pip +RUN pip install --no-cache-dir -r requirements.txt \ + && pip install --no-cache-dir --upgrade pip \ + && apk del .build-deps + + +# Expose port 5000 +EXPOSE 5000