This commit is contained in:
parent
74051a0b43
commit
9f871cc50c
27
.dockerignore
Normal file
27
.dockerignore
Normal 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
|
61
.gitea/workflows/publish.yml
Normal file
61
.gitea/workflows/publish.yml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
name: Publish Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "master"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Restore Docker Cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
id: docker-cache
|
||||||
|
with:
|
||||||
|
path: /usr/bin/docker
|
||||||
|
key: ${{ runner.os }}-docker
|
||||||
|
|
||||||
|
- name: Install Docker (if not cached)
|
||||||
|
if: steps.docker-cache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
wget -q -O /tmp/docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-20.10.23.tgz \
|
||||||
|
&& tar --extract --file /tmp/docker.tgz --directory /usr/bin --strip-components 1 --no-same-owner docker/docker \
|
||||||
|
&& rm -rf /tmp/* &&
|
||||||
|
echo "Done"
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Repo
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.REPO_USERNAME }}
|
||||||
|
password: ${{ secrets.REPO_TOKEN }}
|
||||||
|
|
||||||
|
- name: Restore Docker Build Cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
id: build-cache
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx
|
||||||
|
|
||||||
|
- name: Build and Push (Latest)
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
context: .
|
||||||
|
tags: fascinated/traefik-helper:latest
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
|
- name: Save Docker Build Cache
|
||||||
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/.buildx-cache
|
||||||
|
cp -r /tmp/.buildx-cache/. /tmp/.buildx-cache-new
|
||||||
|
rm -rf /tmp/.buildx-cache
|
||||||
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -174,3 +174,4 @@ cython_debug/
|
|||||||
# Built Visual Studio Code Extensions
|
# Built Visual Studio Code Extensions
|
||||||
*.vsix
|
*.vsix
|
||||||
|
|
||||||
|
config.yml
|
19
.vscode/launch.json
vendored
Normal file
19
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"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
24
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "docker-build",
|
||||||
|
"label": "docker-build",
|
||||||
|
"platform": "python",
|
||||||
|
"dockerBuild": {
|
||||||
|
"tag": "traefikhelper:latest",
|
||||||
|
"dockerfile": "${workspaceFolder}/Dockerfile",
|
||||||
|
"context": "${workspaceFolder}",
|
||||||
|
"pull": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "docker-run",
|
||||||
|
"label": "docker-run: debug",
|
||||||
|
"dependsOn": ["docker-build"],
|
||||||
|
"python": {
|
||||||
|
"file": "manage.py"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
ENV CONFIG_FILE_PATH=/app/config.yml
|
||||||
|
|
||||||
|
CMD ["python", "src/manage.py"]
|
@ -1,2 +1,11 @@
|
|||||||
# traefik-helper
|
# traefik-helper
|
||||||
|
|
||||||
|
This is a helper container for traefik. It can add, remove and update services.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
DO NOT CHANGE: `/home/config.yml`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /home/traefik/data/config.tml:/home/config.yml fascinateed/traefik-helper:latest
|
||||||
|
```
|
||||||
|
13
requirements.txt
Normal file
13
requirements.txt
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# To ensure app dependencies are ported from your virtual environment/host machine into your container, run 'pip freeze > requirements.txt' in the terminal to overwrite this file
|
||||||
|
awscli==1.32.2
|
||||||
|
botocore==1.34.2
|
||||||
|
colorama==0.4.4
|
||||||
|
docutils==0.16
|
||||||
|
jmespath==1.0.1
|
||||||
|
pyasn1==0.5.1
|
||||||
|
python-dateutil==2.8.2
|
||||||
|
PyYAML==6.0.1
|
||||||
|
rsa==4.7.2
|
||||||
|
s3transfer==0.9.0
|
||||||
|
six==1.16.0
|
||||||
|
urllib3==2.0.7
|
@ -1,10 +1,14 @@
|
|||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import yaml
|
import yaml
|
||||||
|
import os
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
baseDir = "/home/traefik/"
|
configFile = "./config.yml"
|
||||||
configFile = baseDir + "data/config.yml"
|
|
||||||
|
# Are we running in a Docker container?
|
||||||
|
if os.environ.get("CONFIG_FILE"):
|
||||||
|
configFile = os.environ.get("CONFIG_FILE")
|
||||||
|
|
||||||
# DO NOT TOUCH
|
# DO NOT TOUCH
|
||||||
commands = ["add", "remove", "list"]
|
commands = ["add", "remove", "list"]
|
||||||
@ -31,7 +35,7 @@ def restartTraefik():
|
|||||||
print("Restarting Traefik...")
|
print("Restarting Traefik...")
|
||||||
|
|
||||||
# Restart Traefik in the base directory
|
# Restart Traefik in the base directory
|
||||||
subprocess.run(["docker", "compose", "restart", "traefik"], cwd=baseDir)
|
subprocess.run(["docker", "restart", "traefik"])
|
||||||
|
|
||||||
def addDomain(name, domain, serviceHost):
|
def addDomain(name, domain, serviceHost):
|
||||||
# Check if name already exists
|
# Check if name already exists
|
Loading…
Reference in New Issue
Block a user