From 96a2b431223a722975a773931cbaac147beef916 Mon Sep 17 00:00:00 2001 From: Corban-Lee Jones Date: Sun, 4 Aug 2024 00:25:07 +0100 Subject: [PATCH] Workflow actions & dockerfile --- .gitea/workflows/docker-build.yml | 42 +++++++++++++++++++++++++++++++ Dockerfile | 10 +++++--- 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 .gitea/workflows/docker-build.yml diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml new file mode 100644 index 0000000..4ff9e48 --- /dev/null +++ b/.gitea/workflows/docker-build.yml @@ -0,0 +1,42 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install bump2version + + - name: Bump version + run: | + bump2version patch + + - name: Build Docker image + run: | + docker build -t pyrss-website:${{ steps.bump-version.outputs.new_version }} . + + - name: Push Docker image + run: | + docker tag pyrss-website:${{ steps.bump-version.outputs.new_version }} xordk/pyrss-website:${{ steps.bump-version.outputs.new_version }} + docker push xordk/pyrss-website:${{ steps.bump-version.outputs.new_version }} + env: + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 253fafb..bd3a603 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,20 @@ -FROM python:3.9 +FROM python:3.11 # set environment variables ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 -COPY requirements.txt . +WORKDIR /app + +COPY requirements.txt /app/ # install python dependencies RUN pip install --upgrade pip RUN pip install --no-cache-dir -r requirements.txt -COPY . . +COPY . /app/ # running migrations RUN python manage.py migrate # gunicorn -CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"] +# CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"]