Skip to content
Snippets Groups Projects
Verified Commit 20e53876 authored by Marco Aceti's avatar Marco Aceti
Browse files

Add Dockerfile and build workflow

parent 469d53a3
Branches
No related tags found
No related merge requests found
data/*
venv/*
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to ghcr registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare version info
run: |
echo "LATEST_COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Write version file
run: echo "${{ env.LATEST_COMMIT_SHA }}" > version.txt
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
tags: |
ghcr.io/marcobuster/railway-opendata:${{ env.LATEST_COMMIT_SHA }}
ghcr.io/marcobuster/railway-opendata:latest
push: true
FROM python:3.11
LABEL org.opencontainers.image.source=https://github.com/MarcoBuster/railway-opendata
LABEL org.opencontainers.image.description="Italian railway opendata scraper and analyzer"
LABEL org.opencontainers.image.licenses=GPL-2.0-or-later
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
VOLUME /app/data
ENV PYTHONHASHSEED=0
COPY . .
ENTRYPOINT ["python", "main.py"]
requests==2.28.2
python-dateutil==2.8.2
dateparser==1.1.0
tqdm==4.65.0
geojson==3.0.1
sentry-sdk==1.18.0
......
......@@ -43,6 +43,10 @@ def get_git_revision_short_hash() -> str:
.strip()
)
except subprocess.CalledProcessError:
try:
with open("version.txt", "r") as f:
return f.read().strip()
except FileNotFoundError:
return "unknown"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment