Skip to content

Commit

Permalink
docker & linting & dependatbot
Browse files Browse the repository at this point in the history
This commit introduces linter and dependabot to monitor dependencies.
It also adds a dockerfile and a workflow to build the image.
  • Loading branch information
tibroc committed Feb 7, 2024
1 parent a9fb55c commit 726593a
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly

- package-ecosystem: docker
directory: /
schedule:
interval: monthly
36 changes: 36 additions & 0 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Docker image

on:
push:

jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: bandit and flake8

on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
# https://endoflife.date/python
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#python
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'

steps:
- uses: actions/checkout@v4

- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- run: pip install -r requirements.txt

- run: pip install flake8 bandit

- run: flake8 *.py

- run: bandit *.py
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.env
venv/
__pycache__/

12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.9-slim
EXPOSE 8501

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

COPY . /app
WORKDIR /app

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

CMD [ "streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
File renamed without changes.

0 comments on commit 726593a

Please sign in to comment.