diff --git a/.dockerignore b/.dockerignore index ba520cc..73f02a3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,16 @@ -db.sqlite3 \ No newline at end of file +docker-compose.yml + +# Docs +README.md +setup.md +LICENSE + +# Git stuff +.git +.github +.gitignore + +# .gitignore +*.pyc +.venv +db.sqlite3 diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 3c38103..aa8a9f2 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -2,8 +2,8 @@ name: update docker image on: push: - branches: - - "master" + tags: + - 'v*.*.*' jobs: build: @@ -23,4 +23,4 @@ jobs: uses: docker/build-push-action@v6 with: push: true - tags: ${{ vars.DOCKERHUB_USERNAME }}/rdgen:latest \ No newline at end of file + tags: ${{ vars.DOCKERHUB_USERNAME }}/rdgen:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5de7316 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM python:3.13-alpine + +RUN adduser -D user +USER user + +WORKDIR /opt/rdgen + +COPY . . +RUN pip install --no-cache-dir -r requirements.txt \ + && python manage.py migrate + +ENV PYTHONUNBUFFERED=1 + +EXPOSE 8000 + +HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD wget --spider 0.0.0.0:8000 + +CMD ["/home/user/.local/bin/gunicorn", "-c", "gunicorn.conf.py", "rdgen.wsgi:application"] diff --git a/dockerfile b/dockerfile deleted file mode 100644 index 15fd770..0000000 --- a/dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM python:3.13 - -WORKDIR /opt/rdgen - -COPY . . - -RUN python -m venv rdgen -RUN chmod +x rdgen/bin/activate -RUN /bin/sh -c rdgen/bin/activate -RUN pip install --no-cache-dir -r requirements.txt -RUN python manage.py migrate - -EXPOSE 8000 - -CMD ["gunicorn", "-c", "gunicorn.conf.py", "rdgen.wsgi:application"] \ No newline at end of file