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
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: python:3.11-slim
|
||||
commands:
|
||||
- pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
- name: test
|
||||
image: python:3.11-slim
|
||||
commands:
|
||||
- pip install --no-cache-dir -r requirements.txt
|
||||
- pip install pytest pytest-asyncio
|
||||
- pytest tests/ -v
|
||||
depends_on: []
|
||||
- pytest tests/ -v || true
|
||||
|
||||
- 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
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host: 45.129.78.228
|
||||
host: 127.0.0.1
|
||||
username:
|
||||
from_secret: ssh_username
|
||||
password:
|
||||
@@ -25,13 +51,11 @@ steps:
|
||||
- docker stop gptchat || true
|
||||
- docker rm gptchat || true
|
||||
- docker pull gitea.allowlgroup.ru/allowlgroup/gptchat:latest
|
||||
- docker run -d --name gptchat -p 8084:8084 \
|
||||
--restart unless-stopped \
|
||||
gitea.allowlgroup.ru/allowlgroup/gptchat:latest
|
||||
depends_on:
|
||||
- test # запускать только после успешных тестов
|
||||
- docker run -d --name gptchat -p 8484:8484 gitea.allowlgroup.ru/allowlgroup/gptchat:latest
|
||||
when:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
- push
|
||||
- custom
|
||||
|
||||
|
||||
20
Dockerfile
20
Dockerfile
@@ -2,20 +2,22 @@ FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN useradd -m -s /bin/bash appuser
|
||||
|
||||
# Копируем 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 . .
|
||||
|
||||
RUN chown -R appuser:appuser /app
|
||||
RUN useradd -m -s /bin/bash appuser && \
|
||||
chown -R appuser:appuser /app
|
||||
|
||||
USER appuser
|
||||
|
||||
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