From eedcc696116c7b6db65b16e972e231a3f5ea9f2b Mon Sep 17 00:00:00 2001 From: Icemap Date: Thu, 20 Jun 2024 18:24:36 +0800 Subject: [PATCH] feat: docker build --- Dockerfile | 16 ++++++++++++++++ Makefile | 10 ++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7c84d7e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM python:3.11.9-slim + +RUN apt-get update + +WORKDIR /app + +COPY requirements.txt /app/requirements.txt +RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir -r /app/requirements.txt + +COPY . /app/ + +ENV PYTHONPATH /app + +EXPOSE 4000 + +CMD ["python", "manage.py", "runserver", "--port", "4000"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ab4e868 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +.PHONY: build start + +build: + docker build -t trans-forum:latest . + +start: + docker run -itd \ + -p 4000:4000 \ + -v .env:/app/.env \ + trans-forum:latest \ No newline at end of file