Add build and docker
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
sclement 2023-10-30 15:03:53 +01:00
parent 0f6b756667
commit e78d40f0b8
7 changed files with 141 additions and 0 deletions

27
.dockerignore Normal file
View File

@ -0,0 +1,27 @@
**/__pycache__
**/.venv
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

15
.vscode/launch.json vendored
View File

@ -12,6 +12,21 @@
"envFile": "${workspaceFolder}/.env",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Docker: Python - General",
"type": "docker",
"request": "launch",
"preLaunchTask": "docker-run: debug",
"python": {
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app"
}
],
"projectType": "general"
}
}
]
}

24
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,24 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "docker-build",
"label": "docker-build",
"platform": "python",
"dockerBuild": {
"tag": "pixivcord:latest",
"dockerfile": "${workspaceFolder}/Dockerfile",
"context": "${workspaceFolder}",
"pull": true
}
},
{
"type": "docker-run",
"label": "docker-run: debug",
"dependsOn": ["docker-build"],
"python": {
"file": "main.py"
}
}
]
}

34
.woodpecker.yml Normal file
View File

@ -0,0 +1,34 @@
steps:
build-only:
image: woodpeckerci/plugin-docker-buildx
settings:
repo: git.sebclem.fr/sebclem/${CI_REPO_NAME}
cache_from: git.sebclem.fr/sebclem/${CI_REPO_NAME}
registry: git.sebclem.fr
dry_run: true
auto_tag: true
logins:
- registry: https://git.sebclem.fr
username:
from_secret: docker_user
password:
from_secret: docker_token
when:
event: [push, pull_request, manual]
publish:
image: woodpeckerci/plugin-docker-buildx
settings:
platforms: linux/amd64
auto_tag: true
repo: git.sebclem.fr/sebclem/${CI_REPO_NAME}
cache_from: git.sebclem.fr/sebclem/${CI_REPO_NAME}
logins:
- registry: https://git.sebclem.fr
username:
from_secret: docker_user
password:
from_secret: docker_token
when:
event:
- tag

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.10-slim
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Install pip requirements
COPY requirements.txt .
RUN python -m pip install -r requirements.txt
WORKDIR /app
COPY . /app
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
CMD ["python", "main.py"]

11
docker-compose.debug.yml Normal file
View File

@ -0,0 +1,11 @@
version: '3.4'
services:
pixivcord:
image: pixivcord
build:
context: .
dockerfile: ./Dockerfile
command: ["sh", "-c", "pip install debugpy -t /tmp && python /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 main.py "]
ports:
- 5678:5678

8
docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
version: '3.4'
services:
pixivcord:
image: pixivcord
build:
context: .
dockerfile: ./Dockerfile