Skip to content

Commit

Permalink
added requirement that was missing, added dockerfile and container bu…
Browse files Browse the repository at this point in the history
…ild workflow
  • Loading branch information
napowderly committed Apr 3, 2024
1 parent ac2e41e commit f920040
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 3 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build_container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Docker Image

on:
push:
tags:
- "v*.*.*"

jobs:
build-and-publish-amd64:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3


- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/jlc-scraper:latest
ghcr.io/${{ github.repository_owner }}/jlc-scraper:${{ github.ref_name }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ node_modules/
# Ignore Python compiled files
*.pyc

*.egg-info/
*.egg-info/

# Ignore virtual environment
venv/
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.12

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "./jlcpcb_scraper/main.py" ]
2 changes: 1 addition & 1 deletion jlcpcb_scraper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
part_count += len(new_parts)
categories_count += len(new_categories)
session.commit()

print(f"Added { part_count } new parts and { categories_count } new categories to the database")

# 6. Remove Parts older than 30 days from the database
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ fake-useragent==1.4.0
sqlalchemy==2.0.27
python-dotenv==1.0.1
alembic==1.13.1
psycopg==3.1.18
psycopg==3.1.18
psycopg2-binary==2.9.8

0 comments on commit f920040

Please sign in to comment.