Skip to content

Commit

Permalink
chore(deps): Python updates, removed requirements.txt (#146)
Browse files Browse the repository at this point in the history
* manual updates with poetry

* simplified python definitions by removing requirements.txt

* removing requirements.txt in build chain
  • Loading branch information
tobiasmllr authored Jun 8, 2024
1 parent 9d3f87a commit 26cd7f0
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
python-version: "3.12"
- name: Install requirements
run: |
pip install -r requirements.txt
pip install .
- name: Run tests
run: |
python manage.py test
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The HydRA app is hosted in the BC Gov GitHub organization and is available at PL

## Managing the app packages

After cloning the repository, use the `poetry` python package manager to install the dependencies by running `poetry install` from the `frontend` directory. To update the dependencies, run `poetry update` or edit the `pyproject.toml` file. To export the dependencies to a `requirements.txt` file for the docker image, run `poetry export -f requirements.txt --output requirements.txt`.
After cloning the repository, use the `poetry` python package manager to install the dependencies by running `poetry install` from the `frontend` directory. To update the dependencies, run `poetry update` or edit the `pyproject.toml` file.

## Running the app locally

Expand Down
8 changes: 5 additions & 3 deletions frontend/Dockerfile.app
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ ENV PYTHONUNBUFFERED 1
ENV PATH="/venv/bin:$PATH"

RUN apt-get update --no-install-recommends && \
apt-get install -y gcc
apt-get install -y gcc

# set up venv
RUN python -m venv /venv

# install requirements
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY pyproject.toml ./
COPY README.md ./
COPY rctool/ ./rctool
RUN pip install . --no-cache-dir

### APP IMAGE ###
FROM python:3.12-slim AS APP
Expand Down
7 changes: 3 additions & 4 deletions frontend/Dockerfile.nginx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ RUN apt-get update --no-install-recommends && \
RUN python -m venv /venv

# install requirements
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN pip install .
RUN python manage.py collectstatic


Expand All @@ -37,13 +36,13 @@ RUN chown -R nginx:nginx /app && chmod -R 777 /app && \
chown -R nginx:nginx /etc/nginx/conf.d && chmod -R 777 /etc/nginx/conf.d && \
chown -R nginx:nginx /etc/nginx/nginx.conf && chmod -R 777 /etc/nginx/nginx.conf
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid && chmod -R 777 /var/run/nginx.pid
chown -R nginx:nginx /var/run/nginx.pid && chmod -R 777 /var/run/nginx.pid

USER nginx


# healthcheck
HEALTHCHECK --interval=60s --timeout=10s \
CMD service nginx status
CMD service nginx status

CMD ["sh", "-c", "/app/start_nginx.sh"]
3 changes: 3 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# rctool

This readme was added to meet pip wheel requirements. For actual readme, see parent directory.
17 changes: 16 additions & 1 deletion frontend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions frontend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[tool.poetry]
name = "frontend"
name = "rctool"
version = "1.0.0"
description = ""
authors = [
"Tobias Mueller <to.mueller@gmail.com",
"Tyler De Jong <TDeJong@nhcweb.com>",
"Tobias Mueller <to.mueller@gmail.com, Tyler De Jong <TDeJong@nhcweb.com>",
]
readme = "README.md"

Expand All @@ -19,7 +18,7 @@ xhtml2pdf = "^0.2.15"
matplotlib = "^3.8.3"
gunicorn = "^22.0.0"
pip = "^24.0"

setuptools = "^70.0.0"

[build-system]
requires = ["poetry-core"]
Expand Down
59 changes: 0 additions & 59 deletions frontend/requirements.txt

This file was deleted.

0 comments on commit 26cd7f0

Please sign in to comment.