Skip to content

Commit

Permalink
Refactor project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
aviolaris committed Jun 16, 2024
1 parent af9e63a commit dec0b8c
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r app/requirements.txt
pip install -r requirements.txt
pip install pytest-cov
- name: Run tests and collect coverage
run: |
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM python:3.11.6-alpine3.18 AS build-stage
LABEL maintainer="Andreas Violaris"
COPY app /app
WORKDIR /app
COPY . /instaunfollowers
WORKDIR /instaunfollowers
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

FROM python:3.11.6-alpine3.18
ENV PYTHONPATH=/usr/local/lib/python3.11/site-packages
COPY --from=build-stage $PYTHONPATH $PYTHONPATH
COPY --from=build-stage /app /app
WORKDIR /app
COPY --from=build-stage /instaunfollowers /instaunfollowers
WORKDIR /instaunfollowers
HEALTHCHECK --interval=12s --timeout=12s --start-period=30s CMD python3 healthcheck.py
ENTRYPOINT ["python3", "app.py"]
ENTRYPOINT ["python3", "-m", "app.app"]
6 changes: 0 additions & 6 deletions app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
"""Imports"""
import sys
# pylint: disable-next=consider-using-from-import
import app.upd as updd

sys.modules['updd'] = updd
2 changes: 1 addition & 1 deletion app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from flask_paginate import Pagination
from werkzeug.utils import secure_filename
from flask_session import Session
from .upd import get_latest_version, update_needed
from app.updsys.upd import get_latest_version, update_needed

app = Flask(__name__)
app.secret_key = "secret_key"
Expand Down
Empty file added app/updsys/__init__.py
Empty file.
File renamed without changes.
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
instaunfollowers:
build:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_upd.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Imports"""
from unittest import TestCase
from app.upd import update_needed
from app.updsys.upd import update_needed


class Test(TestCase):
Expand Down

0 comments on commit dec0b8c

Please sign in to comment.