Workflow actions & dockerfile
This commit is contained in:
parent
1a436c6eb6
commit
96a2b43122
42
.gitea/workflows/docker-build.yml
Normal file
42
.gitea/workflows/docker-build.yml
Normal file
@ -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 }}
|
10
Dockerfile
10
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"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user