Alter 3 files
Add `docker.yml` Add `Dockerfile` Update `web.py`
This commit is contained in:
parent
47301c89a8
commit
6f3fbde11f
3 changed files with 57 additions and 1 deletions
38
.github/workflows/docker.yml
vendored
Normal file
38
.github/workflows/docker.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
env:
|
||||
IMAGE_NAME: "ghcr.io/codemicro/circuitbodge"
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Get tag version
|
||||
id: get_version
|
||||
run: echo "::set-output name=VERSION::$(echo ${GITHUB_REF/refs\/tags\//} | sed "s/^v//")"
|
||||
|
||||
- name: Make image tags
|
||||
id: make_tags
|
||||
run: |
|
||||
echo "::set-output name=LATEST::$IMAGE_NAME:latest"
|
||||
echo "::set-output name=VERSIONED::$IMAGE_NAME:${{ steps.get_version.outputs.VERSION }}"
|
||||
- name: Set version number
|
||||
run: bash setVersionNumber.sh "${{ steps.get_version.outputs.VERSION }}"
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker build . --file Dockerfile --tag ${{ steps.make_tags.outputs.LATEST }} --tag ${{ steps.make_tags.outputs.VERSIONED }}
|
||||
|
||||
- name: Login to ghcr.io
|
||||
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username codemicro --password-stdin
|
||||
|
||||
- name: Push image
|
||||
run: docker push --all-tags $IMAGE_NAME
|
18
Dockerfile
Normal file
18
Dockerfile
Normal file
|
@ -0,0 +1,18 @@
|
|||
FROM python:3.11-alpine
|
||||
|
||||
ENV PIP_DISABLE_PIP_VERSION_CHECK=on
|
||||
|
||||
RUN pip install poetry
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY poetry.lock pyproject.toml ./
|
||||
|
||||
RUN poetry config virtualenvs.create false
|
||||
RUN poetry install --no-interaction
|
||||
|
||||
COPY ./circuit-laundry-notifier ./circuit-laundry-notifier
|
||||
|
||||
ENV PYTHONPATH=circuit-laundry-notifier/
|
||||
|
||||
CMD ["poetry", "run", "gunicorn", "-b", "0.0.0.0:80", "-w", "1", "circuit-laundry-notifier.web:new()"]
|
|
@ -16,7 +16,7 @@ from circuit_scraper import (
|
|||
)
|
||||
|
||||
|
||||
def new(debug=False) -> flask.Flask:
|
||||
def new(debug=True) -> flask.Flask:
|
||||
app = flask.Flask(__name__)
|
||||
|
||||
app.add_url_rule("/", view_func=_web_get_index, methods=["GET"])
|
||||
|
|
Reference in a new issue