Dockerfile
This commit is contained in:
parent
84fe2d5946
commit
f642f9fb6c
3 changed files with 38 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -5,3 +5,4 @@ venv/
|
|||
cache*.json
|
||||
Rostifile
|
||||
__pycache__/
|
||||
.vscode/*.log
|
||||
|
|
|
|||
18
Dockerfile
Normal file
18
Dockerfile
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
FROM python:3.12-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the source files
|
||||
COPY ./calculator /app/calculator
|
||||
COPY ./requirements.txt /app/requirements.txt
|
||||
|
||||
# Install dependencies into a virtual environment
|
||||
RUN python -m venv /app/venv && \
|
||||
/app/venv/bin/pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
||||
|
||||
# Mark data storage and expose port
|
||||
VOLUME /app/cache
|
||||
EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["/app/venv/bin/fastapi"]
|
||||
CMD ["run", "calculator/main.py"]
|
||||
19
Taskfile.yml
19
Taskfile.yml
|
|
@ -2,10 +2,17 @@
|
|||
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
IMAGE: gitea.ceperka.net/cx/pricepower
|
||||
TAG: dev
|
||||
|
||||
tasks:
|
||||
dev :
|
||||
cmds:
|
||||
- fastapi dev calculator/main.py --reload
|
||||
|
||||
# Old app deployment
|
||||
|
||||
deploy:
|
||||
cmds:
|
||||
- ssh -p 11335 app@ssh.rosti.cz mkdir -p /srv/app/cache
|
||||
|
|
@ -13,3 +20,15 @@ tasks:
|
|||
- rsync -av -e "ssh -p 11335" ./requirements.txt app@ssh.rosti.cz:/srv/app/
|
||||
- ssh -p 11335 app@ssh.rosti.cz /srv/venv/bin/pip install -r /srv/app/requirements.txt
|
||||
- ssh -p 11335 app@ssh.rosti.cz supervisorctl restart app
|
||||
|
||||
# New deployment
|
||||
|
||||
build:
|
||||
cmds:
|
||||
- docker build -t {{ .IMAGE }}:{{ .TAG }} .
|
||||
tag-latest:
|
||||
cmds:
|
||||
- docker tag {{ .IMAGE }}:{{ .TAG }} {{ .IMAGE }}:latest
|
||||
push:
|
||||
cmds:
|
||||
- docker push {{ .IMAGE }}:{{ .TAG }}
|
||||
|
|
|
|||
Loading…
Reference in a new issue