aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2025-01-05 19:33:36 +0000
committerMatthew Lemon <y@yulqen.org>2025-01-05 19:33:36 +0000
commit6272ce16883d9337c46af0b790170432b22881ca (patch)
treeace5a43a30caad994fe764a7eeaa7b0349643bc6
parent126a5fb1841aaf95b38cc8d7e5c79561023623f1 (diff)
first attempt - broken Docker implentation
-rw-r--r--Dockerfile33
-rw-r--r--config/settings/production.py2
-rw-r--r--pyproject.toml5
-rw-r--r--requirements.txt128
-rw-r--r--uv.lock26
5 files changed, 58 insertions, 136 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..ddd5b73
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,33 @@
+# Dockerfile for a Django project
+
+FROM python:3.12-slim-bookworm
+
+# The installer requires curl (and certificates) to download the release archive
+RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && apt-get install libmagic-dev -y
+
+# Download the latest installer
+ADD https://astral.sh/uv/install.sh /uv-installer.sh
+
+# Run the installer then remove it
+RUN sh /uv-installer.sh && rm /uv-installer.sh
+
+# Ensure the installed binary is on the `PATH`
+ENV PATH="/root/.local/bin/:$PATH"
+
+ADD . /app
+
+# Set the working directory to /app
+WORKDIR /app
+
+# Make port 8010 available to the world outside this container
+EXPOSE 8010
+
+# Define environment variable
+ENV DJANGO_SETTINGS_MODULE=config.settings.production
+ENV DJANGO_READ_DOT_ENV_FILE=True
+
+RUN uv sync --frozen --no-dev && uv run manage.py collectstatic --noinput
+
+# run gunicorn when the container launches
+# CMD ["uv", "run", "gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8010"]
+CMD ["uv", "run", "manage.py", "runserver", "0.0.0.0:8010"]
diff --git a/config/settings/production.py b/config/settings/production.py
index fcc772e..b2c90b9 100644
--- a/config/settings/production.py
+++ b/config/settings/production.py
@@ -145,7 +145,7 @@ LOGGING = {
"file": {
"level": "DEBUG",
"class": "logging.FileHandler",
- "filename": "/home/django/logfile.log", # Update this path
+ "filename": "/app/logfile.log", # Update this path
},
},
"loggers": {
diff --git a/pyproject.toml b/pyproject.toml
index 8ad37ef..0cb6687 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,4 +1,5 @@
[project]
+requires-python = ">=3.11"
name = "alphabetlearning"
version = "0.1.0"
dependencies = [
@@ -38,15 +39,13 @@ dependencies = [
"sqlparse==0.5.0",
"markdown==3.6.0",
"Werkzeug[watchdog]==3.0.2",
- # https://github.com/pallets/werkzeug
- "psycopg[c]==3.1.19",
# https://github.com/psycopg/psycopg
"watchfiles==0.21.0",
# https://github.com/samuelcolvin/watchfiles
"stripe==11.1.0",
"django-stubs[compatible-mypy]>=5.0.4",
# "django-ratelimit==4.1.0",
- "django-recaptcha==4.0.0"
+ "django-recaptcha==4.0.0",
]
[tool.uv] # https://docs.astral.sh/uv/concepts/dependencies/#development-dependencies
dev-dependencies = [
diff --git a/requirements.txt b/requirements.txt
index 63d441d..973627b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,143 +1,59 @@
# This file was autogenerated by uv via the following command:
-# uv pip compile pyproject.toml -o requirements.txt
-anyio==4.7.0
- # via watchfiles
+# uv export --no-dev --no-hashes --format requirements-txt
+anyio==4.4.0
argon2-cffi==23.1.0
- # via alphabetlearning (pyproject.toml)
argon2-cffi-bindings==21.2.0
- # via argon2-cffi
asgiref==3.8.1
- # via
- # django
- # django-stubs
+async-timeout==4.0.3 ; python_full_version < '3.11.3'
boto3==1.34.89
- # via alphabetlearning (pyproject.toml)
botocore==1.34.162
- # via
- # alphabetlearning (pyproject.toml)
- # boto3
- # s3transfer
-certifi==2024.12.14
- # via requests
+certifi==2024.8.30
cffi==1.17.1
- # via argon2-cffi-bindings
-charset-normalizer==3.4.1
- # via requests
+charset-normalizer==3.3.2
+colorama==0.4.6 ; sys_platform == 'win32'
crispy-bootstrap5==2024.2
- # via alphabetlearning (pyproject.toml)
django==5.1.4
- # via
- # alphabetlearning (pyproject.toml)
- # crispy-bootstrap5
- # django-allauth
- # django-crispy-forms
- # django-model-utils
- # django-recaptcha
- # django-redis
- # django-storages
- # django-stubs
- # django-stubs-ext
django-allauth==0.62.1
- # via alphabetlearning (pyproject.toml)
django-crispy-forms==2.1
- # via
- # alphabetlearning (pyproject.toml)
- # crispy-bootstrap5
django-environ==0.11.2
- # via alphabetlearning (pyproject.toml)
django-model-utils==4.5.1
- # via alphabetlearning (pyproject.toml)
django-recaptcha==4.0.0
- # via alphabetlearning (pyproject.toml)
django-redis==5.4.0
- # via alphabetlearning (pyproject.toml)
django-storages==1.14.3
- # via alphabetlearning (pyproject.toml)
-django-stubs==5.1.1
- # via alphabetlearning (pyproject.toml)
-django-stubs-ext==5.1.1
- # via django-stubs
+django-stubs==5.0.4
+django-stubs-ext==5.0.4
gunicorn==22.0.0
- # via alphabetlearning (pyproject.toml)
-idna==3.10
- # via
- # anyio
- # requests
+idna==3.8
jmespath==1.0.1
- # via
- # boto3
- # botocore
markdown==3.6
- # via alphabetlearning (pyproject.toml)
-markupsafe==3.0.2
- # via werkzeug
-mypy==1.13.0
- # via django-stubs
+markupsafe==2.1.5
+mypy==1.11.2
mypy-extensions==1.0.0
- # via mypy
-packaging==24.2
- # via gunicorn
+packaging==24.1
pdf2image==1.17.0
- # via alphabetlearning (pyproject.toml)
pillow==10.3.0
- # via
- # alphabetlearning (pyproject.toml)
- # pdf2image
psycopg==3.1.19
- # via alphabetlearning (pyproject.toml)
-psycopg-c==3.1.19
- # via psycopg
+psycopg-c==3.1.19 ; implementation_name != 'pypy'
pycparser==2.22
- # via cffi
pypdf2==3.0.1
- # via alphabetlearning (pyproject.toml)
+pypng==0.20220715.0
python-dateutil==2.9.0.post0
- # via botocore
-python-dotenv==1.0.1
- # via alphabetlearning (pyproject.toml)
python-magic==0.4.27
- # via alphabetlearning (pyproject.toml)
python-slugify==8.0.4
- # via alphabetlearning (pyproject.toml)
-qrcode==8.0
- # via django-allauth
-redis==5.2.1
- # via django-redis
+qrcode==7.4.2
+redis==5.0.4
requests==2.32.3
- # via stripe
-s3transfer==0.10.4
- # via boto3
-six==1.17.0
- # via python-dateutil
+s3transfer==0.10.2
+six==1.16.0
sniffio==1.3.1
- # via anyio
sqlparse==0.5.0
- # via
- # alphabetlearning (pyproject.toml)
- # django
stripe==11.1.0
- # via alphabetlearning (pyproject.toml)
text-unidecode==1.3
- # via python-slugify
-types-pyyaml==6.0.12.20241230
- # via django-stubs
+types-pyyaml==6.0.12.20240808
typing-extensions==4.12.2
- # via
- # anyio
- # django-stubs
- # django-stubs-ext
- # mypy
- # psycopg
- # stripe
-urllib3==2.3.0
- # via
- # botocore
- # requests
-watchdog==6.0.0
- # via werkzeug
+tzdata==2024.1 ; sys_platform == 'win32'
+urllib3==2.2.2
+watchdog==5.0.2
watchfiles==0.21.0
- # via alphabetlearning (pyproject.toml)
werkzeug==3.0.2
- # via alphabetlearning (pyproject.toml)
whitenoise==6.6.0
- # via alphabetlearning (pyproject.toml)
diff --git a/uv.lock b/uv.lock
index b646547..b6bea5e 100644
--- a/uv.lock
+++ b/uv.lock
@@ -23,7 +23,6 @@ dependencies = [
{ name = "markdown" },
{ name = "pdf2image" },
{ name = "pillow" },
- { name = "psycopg", extra = ["c"] },
{ name = "pypdf2" },
{ name = "python-magic" },
{ name = "python-slugify" },
@@ -66,7 +65,6 @@ requires-dist = [
{ name = "markdown", specifier = "==3.6.0" },
{ name = "pdf2image", specifier = "==1.17.0" },
{ name = "pillow", specifier = "==10.3.0" },
- { name = "psycopg", extras = ["c"], specifier = "==3.1.19" },
{ name = "pypdf2", specifier = "==3.0.1" },
{ name = "python-magic", specifier = "==0.4.27" },
{ name = "python-slugify", specifier = "==8.0.4" },
@@ -707,30 +705,6 @@ wheels = [
]
[[package]]
-name = "psycopg"
-version = "3.1.19"
-source = { registry = "https://pypi.org/simple" }
-dependencies = [
- { name = "typing-extensions" },
- { name = "tzdata", marker = "sys_platform == 'win32'" },
-]
-sdist = { url = "https://files.pythonhosted.org/packages/e5/b8/dc85a3b5d3576527c288197de5db85edd141d6ce27fcf73e9f77e871824a/psycopg-3.1.19.tar.gz", hash = "sha256:92d7b78ad82426cdcf1a0440678209faa890c6e1721361c2f8901f0dccd62961", size = 147457 }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/f2/cf/172701ea48987548c681e011681dda1d2605131f723e89225477fe7802e9/psycopg-3.1.19-py3-none-any.whl", hash = "sha256:dca5e5521c859f6606686432ae1c94e8766d29cc91f2ee595378c510cc5b0731", size = 179386 },
-]
-
-[package.optional-dependencies]
-c = [
- { name = "psycopg-c", marker = "implementation_name != 'pypy'" },
-]
-
-[[package]]
-name = "psycopg-c"
-version = "3.1.19"
-source = { registry = "https://pypi.org/simple" }
-sdist = { url = "https://files.pythonhosted.org/packages/64/7e/1b75babba770e9869d27e2aed23ee5d903c9aa748d8dd1ef783c9cca1de5/psycopg_c-3.1.19.tar.gz", hash = "sha256:8e90f53c430e7d661cb3a9298e2761847212ead1b24c5fb058fc9d0fd9616017", size = 562146 }
-
-[[package]]
name = "pycparser"
version = "2.22"
source = { registry = "https://pypi.org/simple" }