Skip to content

Commit

Permalink
Add container for app (#5)
Browse files Browse the repository at this point in the history
* initial commit for docker container

* using nginx is not necessary

* added ci to create container

* try to make everythin run with gunicorn

* minor chagnes and dockerignore
  • Loading branch information
BenniWi authored Sep 13, 2023
1 parent 7b9efd8 commit 7df2759
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 1,947 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*/.venv
*/*.lock
26 changes: 26 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build the app container
run: docker build -t benniwi/airodor-wifi:latest --file ./container/Dockerfile .
- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: docker push image
run: docker push benniwi/airodor-wifi:latest
2 changes: 1 addition & 1 deletion airodor_web_app/airodor_web_app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h2>Ventilation Server</h2>
<button type="submit" value="remove" id="submitBtn" style="display: none;">remove selected timer</button>
</form>

<a href="/"><input type="button" value="updateStatus"></a>
<a href="{{url_for('index')}}"><input type="button" value="updateStatus"></a>
</br>
</br>
<textarea name="Communication Log" placeholder="{{comm_log}}" cols="60" rows="12" minlength="1" maxlength="500" readonly></textarea>
Expand Down
5 changes: 5 additions & 0 deletions airodor_web_app/airodor_web_app/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from app import app


if __name__ == '__main__':
app.run()
1,038 changes: 0 additions & 1,038 deletions airodor_web_app/poetry.lock

This file was deleted.

1 change: 1 addition & 0 deletions airodor_web_app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ packages = [{ include = "airodor_web_app", from = "." }]
[tool.poetry.dependencies]
python = "^3.8"
flask = "^2.2.3"
pytz = "^2023.3"
# airodor_wifi_api = { git = "https://github.com/BenniWi/airodor-wifi.git", subdirectory = "airodor_wifi_api", branch = "main" }
airodor_wifi_api = {path = "../airodor_wifi_api", develop = true}

Expand Down
908 changes: 0 additions & 908 deletions airodor_wifi_api/poetry.lock

This file was deleted.

21 changes: 21 additions & 0 deletions container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:latest

# prepare python
RUN pip3 install poetry gunicorn

# copy application
RUN mkdir /app
COPY ./airodor_wifi_api/ /app/airodor_wifi_api
COPY ./airodor_web_app/ /app/airodor_web_app

WORKDIR /app/airodor_web_app/airodor_web_app

# prepare poetry
RUN poetry config virtualenvs.create false
RUN poetry install --only main

# listen on port
EXPOSE 80/tcp

# run on startup
ENTRYPOINT gunicorn --workers 2 --bind 0.0.0.0:80 wsgi:app

0 comments on commit 7df2759

Please sign in to comment.