one pysh
This commit is contained in:
61
.drone.yml
Normal file
61
.drone.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
kind: pipeline
|
||||
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 || true
|
||||
|
||||
- name: docker-build
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: 217.11.166.147:3000/admin/gptchat
|
||||
registry: http://217.11.166.147:3000
|
||||
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: 217.11.166.147
|
||||
username:
|
||||
from_secret: ssh_username
|
||||
password:
|
||||
from_secret: ssh_password
|
||||
port: 22
|
||||
script:
|
||||
- export DOCKER_HOST="unix:///var/run/docker.sock"
|
||||
- docker stop gptchat || true
|
||||
- docker rm gptchat || true
|
||||
- docker pull 217.11.166.147:3000/admin/gptchat:latest
|
||||
- docker run -d --name gptchat -p 8084:8084 217.11.166.147:3000/admin/gptchat:latest
|
||||
when:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
- custom
|
||||
|
||||
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@@ -0,0 +1,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
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN chown -R appuser:appuser /app
|
||||
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8084
|
||||
|
||||
CMD ["python", "main.py", "--enable-gui", "--port", "8084", "--password", "admin"]
|
||||
Reference in New Issue
Block a user