add dockerfile only for django project
This commit is contained in:
@@ -1 +1,7 @@
|
|||||||
.git/*
|
.git
|
||||||
|
.ruff_cache
|
||||||
|
.venv
|
||||||
|
files
|
||||||
|
whoosh_index
|
||||||
|
Dockerfile
|
||||||
|
db.sqlite3
|
||||||
|
|||||||
48
fet2020/Dockerfile
Normal file
48
fet2020/Dockerfile
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
FROM python:3.13-alpine
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
RUN apk add --no-cache --virtual .build-deps ca-certificates gcc linux-headers \
|
||||||
|
musl-dev \
|
||||||
|
jpeg-dev \
|
||||||
|
zlib-dev \
|
||||||
|
libffi-dev \
|
||||||
|
mysql \
|
||||||
|
mariadb-dev \
|
||||||
|
freetype-dev
|
||||||
|
|
||||||
|
# Install latest version of uv
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
|
||||||
|
# # Maybe needed for mysqlclient >= 2.2.0
|
||||||
|
# RUN apt-get update \
|
||||||
|
# && apt-get upgrade -y \
|
||||||
|
# && apt-get install -y gcc default-libmysqlclient-dev build-essential pkg-config
|
||||||
|
|
||||||
|
# Run python in venv
|
||||||
|
RUN python -m venv /opt/venv
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
# Install project dependencies
|
||||||
|
COPY pyproject.toml .
|
||||||
|
RUN uv export --no-hashes --no-dev --format requirements-txt > requirements.txt
|
||||||
|
# RUN uv export --no-hashes --no-dev --frozen --format requirements-txt > requirements.txt
|
||||||
|
RUN pip install --upgrade pip
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Copy django project
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Create APIKEY.txt file for etherpad
|
||||||
|
RUN mkdir -p ./etherpad
|
||||||
|
RUN touch ./etherpad/APIKEY.txt
|
||||||
|
RUN echo "haDF223lfaH79823qwSSdF" >> ./etherpad/APIKEY.txt
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENTRYPOINT ["./docker-entrypoint.sh"]
|
||||||
16
fet2020/docker-entrypoint.sh
Normal file
16
fet2020/docker-entrypoint.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# # Collect static files
|
||||||
|
# echo "Collect static files"
|
||||||
|
# python manage.py collectstatic --noinput
|
||||||
|
|
||||||
|
# Apply database migrations
|
||||||
|
echo "Apply database migrations"
|
||||||
|
python manage.py migrate
|
||||||
|
|
||||||
|
# Start server
|
||||||
|
echo "Starting server"
|
||||||
|
# TODO: FIX insecure!!!
|
||||||
|
python manage.py runserver --insecure 0.0.0.0:8000
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
Reference in New Issue
Block a user