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 PYTHONDONTWRITEBYTECODE=1
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Debian/Ubuntu mirrors for apt
|
# Debian/debian mirrors for apt
|
||||||
RUN rm -f /etc/apt/sources.list.d/debian.sources && \
|
RUN rm -f /etc/apt/sources.list /etc/apt/sources.list.d/* && \
|
||||||
printf '%s
|
printf '%s\n' \
|
||||||
' \
|
'deb https://mirror-linux.runflare.com/debian/ bookworm main contrib non-free non-free-firmware' \
|
||||||
'deb https://linux-mirror.liara.ir/repository/debian bookworm main' \
|
'deb https://mirror-linux.runflare.com/debian/ bookworm-updates main contrib non-free non-free-firmware' \
|
||||||
'deb https://linux-mirror.liara.ir/repository/debian bookworm-updates main' \
|
'deb https://mirror-linux.runflare.com/debian-security/ bookworm-security main contrib non-free non-free-firmware' \
|
||||||
'deb https://linux-mirror.liara.ir/repository/debian-security bookworm-security main' \
|
'' \
|
||||||
|
'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
|
> /etc/apt/sources.list
|
||||||
|
|
||||||
# System deps for MySQL client (pkg-config required by mysqlclient to find libs)
|
# System deps for MySQL client (pkg-config required by mysqlclient to find libs)
|
||||||
@@ -26,11 +31,12 @@ COPY requirements.txt .
|
|||||||
# Python mirrors
|
# Python mirrors
|
||||||
RUN pip config --user set global.index-url https://package-mirror.liara.ir/repository/pypi/simple && \
|
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://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 package-mirror.liara.ir && \
|
||||||
pip config --user set global.trusted-host mirror.cdn.ir && \
|
pip config --user set global.trusted-host mirror.cdn.ir && \
|
||||||
pip config --user set global.trusted-host mirror-pypi.runflare.com
|
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 . .
|
COPY . .
|
||||||
|
|
||||||
|
|||||||
+17
-24
@@ -1,10 +1,8 @@
|
|||||||
# Production: no source mount; image contains code
|
|
||||||
name: sensor-hub
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: mysql:8.0
|
image: docker.iranserver.com/mysql:8.0
|
||||||
container_name: sensor-hub-db
|
container_name: sensor-hub-db
|
||||||
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
MYSQL_DATABASE: ${DB_NAME:-sensor_hub}
|
MYSQL_DATABASE: ${DB_NAME:-sensor_hub}
|
||||||
MYSQL_USER: ${DB_USER:-sensor_hub}
|
MYSQL_USER: ${DB_USER:-sensor_hub}
|
||||||
@@ -12,30 +10,22 @@ services:
|
|||||||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
||||||
volumes:
|
volumes:
|
||||||
- sensor_hub_mysql_data:/var/lib/mysql
|
- sensor_hub_mysql_data:/var/lib/mysql
|
||||||
restart: unless-stopped
|
|
||||||
healthcheck:
|
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
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
networks:
|
||||||
phpmyadmin:
|
- sensor-network
|
||||||
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
|
|
||||||
|
|
||||||
web:
|
web:
|
||||||
build: .
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
container_name: sensor-hub-web
|
container_name: sensor-hub-web
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "8010:8000"
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
@@ -43,9 +33,12 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
restart: unless-stopped
|
networks:
|
||||||
ports:
|
- sensor-network
|
||||||
- "8010:8000"
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
sensor_hub_mysql_data:
|
sensor_hub_mysql_data:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
sensor-network:
|
||||||
|
driver: bridge
|
||||||
|
|||||||
Reference in New Issue
Block a user