add Docker
This commit is contained in:
parent
feb21a4292
commit
986b8ba632
2 changed files with 56 additions and 1 deletions
30
Dockerfile
Normal file
30
Dockerfile
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
from python:3.13
|
||||||
|
WORKDIR /app
|
||||||
|
COPY src src
|
||||||
|
COPY pyproject.toml .
|
||||||
|
COPY uv.lock .
|
||||||
|
COPY README.md .
|
||||||
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
ENV VIRTUAL_ENV=/app/.venv
|
||||||
|
ENV PATH=${VIRTUAL_ENV}/bin:${PATH}
|
||||||
|
|
||||||
|
RUN useradd -m appuser && chown -R appuser:appuser /app
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
ENV HOME=/home/appuser
|
||||||
|
ENV PATH=${HOME}/.local/bin:${PATH}
|
||||||
|
|
||||||
|
RUN pip install --upgrade pip && \
|
||||||
|
pip install uv && \
|
||||||
|
uv venv
|
||||||
|
RUN uv pip install -r requirements.txt
|
||||||
|
RUN uv pip install .
|
||||||
|
|
||||||
|
COPY static static
|
||||||
|
COPY templates templates
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENTRYPOINT ["uvicorn"]
|
||||||
|
CMD ["src.fastapi_dynamic_response.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
27
justfile
27
justfile
|
|
@ -1,9 +1,34 @@
|
||||||
|
set dotenv-load
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@just --choose
|
@just --choose
|
||||||
|
|
||||||
|
setup: kind-create argo-install
|
||||||
|
|
||||||
|
teardown: kind-delete
|
||||||
|
|
||||||
|
kind-create:
|
||||||
|
kind create cluster --name fastapi-dynamic-response
|
||||||
|
|
||||||
|
kind-delete:
|
||||||
|
kind delete cluster --name fastapi-dynamic-response
|
||||||
|
|
||||||
|
argo-install:
|
||||||
|
kubectl create namespace argocd
|
||||||
|
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
|
||||||
|
kubectl get pods -n argocd
|
||||||
|
kubectl apply -f argo
|
||||||
|
|
||||||
|
compile:
|
||||||
|
uv pip compile pyproject.toml -o requirements.txt
|
||||||
venv:
|
venv:
|
||||||
uv venv
|
uv venv
|
||||||
|
build-podman:
|
||||||
|
podman build -t docker.io/waylonwalker/fastapi-dynamic-response:0.0.2 .
|
||||||
|
run-podman:
|
||||||
|
podman run -it --rm -p 8000:8000 --name fastapi-dynamic-response docker.io/waylonwalker/fastapi-dynamic-response:0.0.2
|
||||||
|
push-podman:
|
||||||
|
podman push docker.io/waylonwalker/fastapi-dynamic-response:0.0.2
|
||||||
run:
|
run:
|
||||||
uv run -- uvicorn --reload --log-level debug src.fastapi_dynamic_response.main:app
|
uv run -- uvicorn --reload --log-level debug src.fastapi_dynamic_response.main:app
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue