mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-16 18:51:50 +02:00
Compare commits
5 commits
c3f9adb64c
...
6b0bd85a3c
Author | SHA1 | Date | |
---|---|---|---|
6b0bd85a3c | |||
![]() |
19c4a0b6ed | ||
![]() |
9589bcf48d | ||
9f8be6d52d | |||
5a4260ed42 |
7 changed files with 95 additions and 16 deletions
87
Dockerfile
87
Dockerfile
|
@ -1,16 +1,81 @@
|
||||||
FROM python:3.11-slim
|
# Stage 1: General debian environment
|
||||||
|
FROM debian:stable-slim AS linux-base
|
||||||
|
|
||||||
WORKDIR /srv/app
|
# Assure UTF-8 encoding is used.
|
||||||
|
ENV LC_CTYPE=C.utf8
|
||||||
|
# Location of the virtual environment
|
||||||
|
ENV UV_PROJECT_ENVIRONMENT="/venv"
|
||||||
|
# Location of the python installation via uv
|
||||||
|
ENV UV_PYTHON_INSTALL_DIR="/python"
|
||||||
|
# Byte compile the python files on installation
|
||||||
|
ENV UV_COMPILE_BYTECODE=1
|
||||||
|
# Python verision to use
|
||||||
|
ENV UV_PYTHON=python3.12
|
||||||
|
# Tweaking the PATH variable for easier use
|
||||||
|
ENV PATH="$UV_PROJECT_ENVIRONMENT/bin:$PATH"
|
||||||
|
|
||||||
RUN apt update && \
|
# Update debian
|
||||||
apt install --no-install-recommends -y libpq-dev build-essential curl gcc sassc libpango-1.0-0 libpangoft2-1.0-0 libjpeg-dev libopenjp2-7-dev libffi-dev libpangoft2-1.0-0 libcairo2 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 shared-mime-info gettext &&\
|
RUN apt-get update
|
||||||
rm -rf /var/lib/apt/lists/*
|
RUN apt-get upgrade -y
|
||||||
|
|
||||||
COPY --chown=www-data:www-data . .
|
# Install general required dependencies
|
||||||
|
RUN apt-get install --no-install-recommends -y tzdata \
|
||||||
|
libpango-1.0-0 \
|
||||||
|
libpangoft2-1.0-0 \
|
||||||
|
libjpeg-dev \
|
||||||
|
libopenjp2-7-dev \
|
||||||
|
libffi-dev \
|
||||||
|
libpangoft2-1.0-0 \
|
||||||
|
libcairo2 \
|
||||||
|
libpangocairo-1.0-0 \
|
||||||
|
libgdk-pixbuf2.0-0 \
|
||||||
|
shared-mime-info \
|
||||||
|
gettext \
|
||||||
|
tini
|
||||||
|
|
||||||
run python -m pip install --upgrade pip \
|
# Stage 2: Python environment
|
||||||
&& python -m pip install uwsgi \
|
FROM linux-base AS python-base
|
||||||
&& python -m pip install -r requirements.txt \
|
|
||||||
&& python -m pip install .
|
|
||||||
|
|
||||||
ENTRYPOINT [ "uwsgi", "-i", "uwsgi.ini" ]
|
# Install debian dependencies
|
||||||
|
RUN apt-get install --no-install-recommends -y \
|
||||||
|
libpq-dev \
|
||||||
|
build-essential \
|
||||||
|
curl \
|
||||||
|
gcc \
|
||||||
|
sassc
|
||||||
|
|
||||||
|
# Install uv
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
||||||
|
|
||||||
|
# Create virtual environment and install dependencies
|
||||||
|
COPY pyproject.toml ./
|
||||||
|
COPY uv.lock ./
|
||||||
|
RUN uv sync --frozen --no-dev --no-install-project
|
||||||
|
RUN uv pip install granian
|
||||||
|
|
||||||
|
# Stage 3: Building environment
|
||||||
|
FROM python-base AS builder-base
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
# Build static files
|
||||||
|
RUN python manage.py compilescss
|
||||||
|
RUN python manage.py collectstatic --no-input
|
||||||
|
|
||||||
|
# Compile translation files
|
||||||
|
# RUN python manage.py compilemessages
|
||||||
|
|
||||||
|
|
||||||
|
# Stage 4: Webapp environment
|
||||||
|
FROM linux-base AS webapp
|
||||||
|
|
||||||
|
# Copy python, virtual env and static assets
|
||||||
|
COPY --from=builder-base $UV_PYTHON_INSTALL_DIR $UV_PYTHON_INSTALL_DIR
|
||||||
|
COPY --from=builder-base $UV_PROJECT_ENVIRONMENT $UV_PROJECT_ENVIRONMENT
|
||||||
|
COPY --from=builder-base /app /app
|
||||||
|
|
||||||
|
# Start the application server
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 8000
|
||||||
|
CMD ["docker/entrypoint.sh"]
|
||||||
|
|
14
docker/entrypoint.sh
Executable file
14
docker/entrypoint.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
echo "Migrate database..."
|
||||||
|
python manage.py migrate --settings local_settings
|
||||||
|
|
||||||
|
echo "Start server..."
|
||||||
|
|
||||||
|
granian la_chariotte.wsgi:application \
|
||||||
|
--host 127.0.0.1 \
|
||||||
|
--port 8000 \
|
||||||
|
--interface wsgi \
|
||||||
|
--no-ws \
|
||||||
|
--loop uvloop
|
|
@ -6,7 +6,7 @@ started.
|
||||||
The first step is to clone the project, you can find more information about that in
|
The first step is to clone the project, you can find more information about that in
|
||||||
the [getting started guide](../install.md). Once that's done, you can:
|
the [getting started guide](../install.md). Once that's done, you can:
|
||||||
|
|
||||||
- choose a task [on the board](https://gitlab.com/la-chariotte/la_chariotte/-/boards) and assign it to
|
- choose a task [on the board](https://framagit.org/la-chariotte/la-chariotte/-/boards) and assign it to
|
||||||
yourself - if you don't know which task to do, feel free to reach to
|
yourself - if you don't know which task to do, feel free to reach to
|
||||||
us.
|
us.
|
||||||
- create a new branch **from develop** naming it to reflect what you want to do
|
- create a new branch **from develop** naming it to reflect what you want to do
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
- **docs.chariotte.fr**, the docs you are reading now. It's handled by [readthedocs.org](https://readthedocs.org).
|
- **docs.chariotte.fr**, the docs you are reading now. It's handled by [readthedocs.org](https://readthedocs.org).
|
||||||
- **chariotte.fr**, the main instance. It's deployed on Alwaysdata
|
- **chariotte.fr**, the main instance. It's deployed on Alwaysdata
|
||||||
- **blog.chariotte.fr**, our blog. It's [a static website](https://gitlab.com/la-chariotte/la-chariotte.gitlab.io) deployed on Gitlab pages.
|
- **blog.chariotte.fr**, our blog. It's [a static website](https://framagit.org/la-chariotte/la-chariotte.frama.io) deployed on Gitlab pages.
|
||||||
|
|
||||||
## The main instance
|
## The main instance
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
First, clone the project
|
First, clone the project
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone git@gitlab.com:la-chariotte/la_chariotte.git
|
git clone https://framagit.org/la-chariotte/la-chariotte.git
|
||||||
```
|
```
|
||||||
|
|
||||||
## Virtual environment
|
## Virtual environment
|
||||||
|
|
|
@ -7,7 +7,7 @@ from sentry_sdk.integrations.django import DjangoIntegration
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
BASE_URL = os.getenv("BASE_URL", "http://127.0.0.1:8000")
|
BASE_URL = os.getenv("BASE_URL", "http://127.0.0.1:8000")
|
||||||
PROJECT_NAME = os.getenv("PROJECT_NAME", "La Chariotte")
|
PROJECT_NAME = os.getenv("PROJECT_NAME", "La Chariotte")
|
||||||
GITLAB_LINK = "https://gitlab.com/la-chariotte/la_chariotte"
|
GITLAB_LINK = "https://framagit.org/la-chariotte/la-chariotte"
|
||||||
CONTACT_MAIL = "contact@chariotte.fr"
|
CONTACT_MAIL = "contact@chariotte.fr"
|
||||||
HELLOASSO_LINK = "https://www.helloasso.com/associations/la-chariotte/"
|
HELLOASSO_LINK = "https://www.helloasso.com/associations/la-chariotte/"
|
||||||
FEEDBACK_LINK = "https://framaforms.org/votre-avis-sur-la-chariotte-1709742328"
|
FEEDBACK_LINK = "https://framaforms.org/votre-avis-sur-la-chariotte-1709742328"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
site_name: La chariotte
|
site_name: La chariotte
|
||||||
site_description: An application for grouped-orders
|
site_description: An application for grouped-orders
|
||||||
repo_name: la-chariotte/la_chariotte
|
repo_name: la-chariotte/la_chariotte
|
||||||
repo_url: https://gitlab.com/la-chariotte/la_chariotte
|
repo_url: https://framagit.org/la-chariotte/la-chariotte
|
||||||
nav:
|
nav:
|
||||||
- How-tos:
|
- How-tos:
|
||||||
- Getting started: install.md
|
- Getting started: install.md
|
||||||
|
|
Loading…
Reference in a new issue