test
This commit is contained in:
parent
09ff6dd430
commit
5d5c4838f1
23
.env.example
23
.env.example
@ -1,23 +0,0 @@
|
|||||||
# Database Configuration
|
|
||||||
MYSQL_HOST=172.18.0.1
|
|
||||||
MYSQL_PORT=3306
|
|
||||||
MYSQL_DATABASE=planning
|
|
||||||
MYSQL_USER=planning
|
|
||||||
MYSQL_PASSWORD=change-me
|
|
||||||
MYSQL_ROOT_PASSWORD=change-me
|
|
||||||
|
|
||||||
# Django
|
|
||||||
SECRET_KEY=change-me
|
|
||||||
DEBUG=False
|
|
||||||
ADMIN_USERNAME=admin
|
|
||||||
ADMIN_PASSWORD=change-me
|
|
||||||
ADMIN_FIRST_NAME=Admin
|
|
||||||
ADMIN_LAST_NAME=
|
|
||||||
ALLOWED_HOSTS=localhost,127.0.0.1,192.168.1.19,planning.example.com
|
|
||||||
CSRF_TRUSTED_ORIGINS=http://localhost:1025,http://localhost:1031,http://192.168.1.19:1025,http://192.168.1.19:1031,https://planning.example.com
|
|
||||||
CORS_ALLOWED_ORIGINS=http://localhost:1025,http://192.168.1.19:1025,https://planning.example.com
|
|
||||||
PUBLIC_SITE_URL=https://planning.example.com
|
|
||||||
|
|
||||||
# Notifications (optional)
|
|
||||||
NTFY_SERVER=https://ntfy.sh
|
|
||||||
NTFY_TOPIC=
|
|
||||||
@ -1,9 +1,17 @@
|
|||||||
FROM python:3.12-slim
|
FROM python:3.11-slim
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
gcc \
|
||||||
|
default-libmysqlclient-dev \
|
||||||
|
pkg-config \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY requirements.txt .
|
|
||||||
|
COPY requirements.txt /app/requirements.txt
|
||||||
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
COPY . .
|
|
||||||
RUN chmod +x /app/entrypoint.sh
|
COPY . /app/
|
||||||
EXPOSE 8000
|
|
||||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
CMD ["python", "manage.py", "runserver", "0.0.0.0:1031"]
|
||||||
@ -1,6 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
python manage.py wait_for_db
|
|
||||||
python manage.py migrate --noinput
|
|
||||||
python manage.py ensure_admin
|
|
||||||
exec gunicorn planning.wsgi:application --bind 0.0.0.0:8000 --workers 2 --threads 4 --timeout 60 --access-logfile - --error-logfile -
|
|
||||||
@ -5,3 +5,4 @@ django-cors-headers==4.9.0
|
|||||||
gunicorn==23.0.0
|
gunicorn==23.0.0
|
||||||
PyMySQL==1.1.2
|
PyMySQL==1.1.2
|
||||||
requests==2.32.5
|
requests==2.32.5
|
||||||
|
cryptography
|
||||||
@ -1,19 +1,38 @@
|
|||||||
services:
|
services:
|
||||||
|
db:
|
||||||
|
image: mysql:8.0
|
||||||
|
restart: always
|
||||||
|
env_file:
|
||||||
|
- ".env"
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/mysql
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
build: ./backend
|
build: ./backend
|
||||||
container_name: planning-backend
|
volumes:
|
||||||
restart: unless-stopped
|
- ./backend:/app
|
||||||
env_file: .env
|
|
||||||
ports:
|
ports:
|
||||||
- "1031:8000"
|
- "1031:1031"
|
||||||
extra_hosts:
|
env_file:
|
||||||
- "host.docker.internal:host-gateway"
|
- ".env"
|
||||||
|
environment:
|
||||||
|
MYSQL_HOST: db
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
frontend:
|
frontend:
|
||||||
build: ./frontend
|
build: ./frontend
|
||||||
container_name: planning-frontend
|
volumes:
|
||||||
restart: unless-stopped
|
- ./frontend:/app
|
||||||
|
- /app/node_modules
|
||||||
|
ports:
|
||||||
|
- "1025:1025"
|
||||||
|
env_file:
|
||||||
|
- ".env"
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
ports:
|
|
||||||
- "1025:80"
|
volumes:
|
||||||
|
db_data:
|
||||||
|
|
||||||
|
|||||||
71
dockerfile
Normal file
71
dockerfile
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
FROM node:20-bookworm
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
python3 \
|
||||||
|
python3-pip \
|
||||||
|
python3-venv \
|
||||||
|
python3-dev \
|
||||||
|
gcc \
|
||||||
|
default-libmysqlclient-dev \
|
||||||
|
pkg-config \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
bash \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Environnement Python
|
||||||
|
RUN python3 -m venv /opt/venv
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
|
# Utilisateur Pterodactyl
|
||||||
|
RUN useradd -m -d /home/container -s /bin/bash container \
|
||||||
|
&& mkdir -p /home/container \
|
||||||
|
&& chown -R container:container /home/container
|
||||||
|
|
||||||
|
WORKDIR /home/container
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# Backend
|
||||||
|
# -------------------------
|
||||||
|
|
||||||
|
COPY backend/requirements.txt /tmp/requirements.txt
|
||||||
|
|
||||||
|
RUN pip install --no-cache-dir \
|
||||||
|
-r /tmp/requirements.txt
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# Frontend
|
||||||
|
# -------------------------
|
||||||
|
|
||||||
|
COPY frontend/package*.json /tmp/frontend/
|
||||||
|
|
||||||
|
WORKDIR /tmp/frontend
|
||||||
|
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# Application
|
||||||
|
# -------------------------
|
||||||
|
|
||||||
|
WORKDIR /home/container
|
||||||
|
|
||||||
|
COPY --chown=container:container backend /home/container/backend
|
||||||
|
COPY --chown=container:container frontend /home/container/frontend
|
||||||
|
|
||||||
|
# On remet les node_modules installés
|
||||||
|
RUN rm -rf /home/container/frontend/node_modules \
|
||||||
|
&& cp -a /tmp/frontend/node_modules /home/container/frontend/node_modules \
|
||||||
|
&& chown -R container:container /home/container
|
||||||
|
|
||||||
|
COPY --chown=container:container start.sh /home/container/start.sh
|
||||||
|
|
||||||
|
RUN chmod +x /home/container/start.sh
|
||||||
|
|
||||||
|
USER container
|
||||||
|
|
||||||
|
ENV USER=container
|
||||||
|
ENV HOME=/home/container
|
||||||
|
|
||||||
|
CMD ["/bin/bash", "/home/container/start.sh"]
|
||||||
@ -1,11 +1,14 @@
|
|||||||
FROM node:22-alpine AS build
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
|
||||||
COPY package*.json ./
|
WORKDIR /app
|
||||||
RUN npm install
|
|
||||||
COPY . .
|
COPY package*.json ./
|
||||||
RUN npm run build
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
EXPOSE 1025
|
||||||
|
|
||||||
|
CMD ["npm", "run", "dev", "--", "--host", "--port", "1025"]
|
||||||
|
|
||||||
FROM nginx:1.27-alpine
|
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
|
||||||
EXPOSE 80
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user