CI/CD
This commit is contained in:
+15
-9
@@ -1,17 +1,22 @@
|
||||
FROM python:3.12-slim
|
||||
FROM docker.iranserver.com/python:3.10
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Debian/Ubuntu mirrors for apt
|
||||
RUN rm -f /etc/apt/sources.list.d/debian.sources && \
|
||||
printf '%s
|
||||
' \
|
||||
'deb https://linux-mirror.liara.ir/repository/debian bookworm main' \
|
||||
'deb https://linux-mirror.liara.ir/repository/debian bookworm-updates main' \
|
||||
'deb https://linux-mirror.liara.ir/repository/debian-security bookworm-security main' \
|
||||
# Debian/debian mirrors for apt
|
||||
RUN rm -f /etc/apt/sources.list /etc/apt/sources.list.d/* && \
|
||||
printf '%s\n' \
|
||||
'deb https://mirror-linux.runflare.com/debian/ bookworm main contrib non-free non-free-firmware' \
|
||||
'deb https://mirror-linux.runflare.com/debian/ bookworm-updates main contrib non-free non-free-firmware' \
|
||||
'deb https://mirror-linux.runflare.com/debian-security/ bookworm-security main contrib non-free non-free-firmware' \
|
||||
'' \
|
||||
'deb [trusted=yes] https://mirror2.chabokan.net/debian bookworm main contrib non-free non-free-firmware' \
|
||||
'deb [trusted=yes] https://mirror2.chabokan.net/debian-security bookworm-security main contrib non-free non-free-firmware' \
|
||||
'' \
|
||||
'deb http://mirror.iranserver.com/debian/ bookworm main contrib non-free non-free-firmware' \
|
||||
'deb-src http://mirror.iranserver.com/debian/ bookworm main contrib non-free non-free-firmware' \
|
||||
> /etc/apt/sources.list
|
||||
|
||||
# System deps for MySQL client (pkg-config required by mysqlclient to find libs)
|
||||
@@ -26,11 +31,12 @@ COPY requirements.txt .
|
||||
# Python mirrors
|
||||
RUN pip config --user set global.index-url https://package-mirror.liara.ir/repository/pypi/simple && \
|
||||
pip config --user set global.extra-index-url https://mirror.cdn.ir/repository/pypi/simple && \
|
||||
pip config --user set global.extra-index-url https://mirror2.chabokan.net/pypi/simple && \
|
||||
pip config --user set global.trusted-host package-mirror.liara.ir && \
|
||||
pip config --user set global.trusted-host mirror.cdn.ir && \
|
||||
pip config --user set global.trusted-host mirror-pypi.runflare.com
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
|
||||
+17
-24
@@ -1,10 +1,8 @@
|
||||
# Production: no source mount; image contains code
|
||||
name: sensor-hub
|
||||
|
||||
services:
|
||||
db:
|
||||
image: mysql:8.0
|
||||
image: docker.iranserver.com/mysql:8.0
|
||||
container_name: sensor-hub-db
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_DATABASE: ${DB_NAME:-sensor_hub}
|
||||
MYSQL_USER: ${DB_USER:-sensor_hub}
|
||||
@@ -12,30 +10,22 @@ services:
|
||||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
||||
volumes:
|
||||
- sensor_hub_mysql_data:/var/lib/mysql
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${DB_ROOT_PASSWORD}"]
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$${MYSQL_ROOT_PASSWORD}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin:latest
|
||||
container_name: sensor-hub-phpmyadmin
|
||||
environment:
|
||||
PMA_HOST: db
|
||||
PMA_PORT: 3306
|
||||
UPLOAD_LIMIT: 64M
|
||||
ports:
|
||||
- "8081:80"
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- sensor-network
|
||||
|
||||
web:
|
||||
build: .
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: sensor-hub-web
|
||||
restart: always
|
||||
ports:
|
||||
- "8010:8000"
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
@@ -43,9 +33,12 @@ services:
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8010:8000"
|
||||
networks:
|
||||
- sensor-network
|
||||
|
||||
volumes:
|
||||
sensor_hub_mysql_data:
|
||||
|
||||
networks:
|
||||
sensor-network:
|
||||
driver: bridge
|
||||
|
||||
Reference in New Issue
Block a user