Skip to content

Commit

Permalink
fix install issue
Browse files Browse the repository at this point in the history
  • Loading branch information
proquickly committed Dec 13, 2024
1 parent 98ec6de commit 8abc19f
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 57 deletions.
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM python:3.13.1-slim-bullseye
RUN apt-get update && apt-get install -y zsh gcc python3-dev git
SHELL ["/bin/zsh", "-c", "-o", "pipefail"]

RUN if ! getent passwd app; then groupadd -g 1000 app \
&& useradd -u 1000 -g 1000 -d /home/app -m -s /bin/zsh app; fi \
&& echo app:app | chpasswd \
&& echo 'app ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
&& mkdir -p /etc/sudoers.d \
&& echo 'app ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/app \
&& chmod 0440 /etc/sudoers.d/app \
&& apt-get autoremove \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

USER app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PATH='/home/app/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
RUN pip3 install --user --upgrade pip \
&& pip3 install poetry \
&& git config --global user.email "[email protected]" && git config --global user.name "Andy Miles"
WORKDIR /home/app/app
COPY ./pyproject.toml .
RUN /home/app/.local/bin/poetry install
CMD ["/bin/zsh"]
6 changes: 6 additions & 0 deletions Dockerfile.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#TBD
FROM python:3.13.1

WORKDIR /app
COPY dist/*.whl ./
RUN pip install $(find . -name "*.whl" -type f -printf "%T@ %p\n" | sort -n | tail -1 | cut -f2- -d" ")
2 changes: 2 additions & 0 deletions pb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/zsh
docker build -t pyhack .
167 changes: 110 additions & 57 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/zsh
docker run --rm -it -v .:/home/app/app --name pyhack pyhack zsh
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ packages = [{include = "tfgha", from = "src"}]
[tool.poetry.dependencies]
python = "^3.10"
flask = "^3.1.0"
pytest = "^8.3.4"

[build-system]
requires = ["poetry-core"]
Expand Down
9 changes: 9 additions & 0 deletions terraform.tfstate
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"version": 4,
"terraform_version": "1.10.1",
"serial": 1,
"lineage": "cb138770-1fe6-6faa-5599-bff5a0733eb6",
"outputs": {},
"resources": [],
"check_results": null
}
4 changes: 4 additions & 0 deletions tests/test_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import tfgha.app

def test_app():
assert tfgha.app.hello() == "Hello from Python deployed with poetry"

0 comments on commit 8abc19f

Please sign in to comment.