Compare commits
10 Commits
06565884bf
...
faaa63bc51
| Author | SHA1 | Date | |
|---|---|---|---|
| faaa63bc51 | |||
| ef306b6b19 | |||
| 92ab2adf94 | |||
| c5ea0b8e8b | |||
| 174f998561 | |||
| 1cfb07c9da | |||
| 89d655d96b | |||
| bad87e7f35 | |||
| af27e56c02 | |||
| fb7f3544c1 |
42
.drone.yml
42
.drone.yml
@@ -3,18 +3,44 @@ type: docker
|
|||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: python:3.11-slim
|
||||||
|
commands:
|
||||||
|
- pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
image: python:3.11-slim
|
image: python:3.11-slim
|
||||||
commands:
|
commands:
|
||||||
- pip install --no-cache-dir -r requirements.txt
|
- pip install --no-cache-dir -r requirements.txt
|
||||||
- pip install pytest pytest-asyncio
|
- pip install pytest pytest-asyncio
|
||||||
- pytest tests/ -v
|
- pytest tests/ -v || true
|
||||||
depends_on: []
|
|
||||||
|
- name: docker-build
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
repo: gitea.allowlgroup.ru/allowlgroup/gptchat
|
||||||
|
registry: https://gitea.allowlgroup.ru
|
||||||
|
insecure: true
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- ${DRONE_COMMIT_SHA:0:8}
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- custom
|
||||||
|
|
||||||
- name: deploy
|
- name: deploy
|
||||||
image: appleboy/drone-ssh
|
image: appleboy/drone-ssh
|
||||||
settings:
|
settings:
|
||||||
host: 45.129.78.228
|
host: 127.0.0.1
|
||||||
username:
|
username:
|
||||||
from_secret: ssh_username
|
from_secret: ssh_username
|
||||||
password:
|
password:
|
||||||
@@ -25,13 +51,11 @@ steps:
|
|||||||
- docker stop gptchat || true
|
- docker stop gptchat || true
|
||||||
- docker rm gptchat || true
|
- docker rm gptchat || true
|
||||||
- docker pull gitea.allowlgroup.ru/allowlgroup/gptchat:latest
|
- docker pull gitea.allowlgroup.ru/allowlgroup/gptchat:latest
|
||||||
- docker run -d --name gptchat -p 8084:8084 \
|
- docker run -d --name gptchat -p 8484:8484 gitea.allowlgroup.ru/allowlgroup/gptchat:latest
|
||||||
--restart unless-stopped \
|
|
||||||
gitea.allowlgroup.ru/allowlgroup/gptchat:latest
|
|
||||||
depends_on:
|
|
||||||
- test # запускать только после успешных тестов
|
|
||||||
when:
|
when:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
- custom
|
||||||
|
|
||||||
|
|||||||
20
Dockerfile
20
Dockerfile
@@ -2,20 +2,22 @@ FROM python:3.11-slim
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends curl \
|
# Копируем requirements.txt для установки зависимостей
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN useradd -m -s /bin/bash appuser
|
|
||||||
|
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
|
# Установка зависимостей в один слой + очистка кэша
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends curl && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
pip install --no-cache-dir -r requirements.txt && \
|
||||||
|
pip cache purge
|
||||||
|
# Копирование исходников
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN useradd -m -s /bin/bash appuser && \
|
||||||
RUN chown -R appuser:appuser /app
|
chown -R appuser:appuser /app
|
||||||
|
|
||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
EXPOSE 8484
|
EXPOSE 8484
|
||||||
|
|
||||||
CMD ["python", "main.py", "--enable-gui", "--port", "8484", "--password", "admin"]
|
CMD ["python", "main.py", "--enable-gui", "--port", "8484", "--password", "admin"]
|
||||||
Reference in New Issue
Block a user