Skip to content

Commit 90ec4eb

Browse files
committed
Initial commit
0 parents  commit 90ec4eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2849
-0
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git
2+
.gitingore
3+
__pycache__
4+
*.md
5+
!README*.md
6+
README-secret.md
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: build-and-push-v2
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
8+
on:
9+
release:
10+
types: [published]
11+
push:
12+
branches: [ "master" ]
13+
# Publish semver tags as releases.
14+
tags: [ 'v*.*.*' ]
15+
pull_request:
16+
branches: [ "master" ]
17+
18+
env:
19+
# Use docker.io for Docker Hub if empty
20+
REGISTRY: ghcr.io
21+
# github.repository as <account>/<repo>
22+
IMAGE_NAME: ${{ github.repository }}
23+
24+
25+
jobs:
26+
build:
27+
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
31+
packages: write
32+
# This is used to complete the identity challenge
33+
# with sigstore/fulcio when running outside of PRs.
34+
id-token: write
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v3
39+
40+
# Install the cosign tool except on PR
41+
# https://github.com/sigstore/cosign-installer
42+
# - name: Install cosign
43+
# if: github.event_name != 'pull_request'
44+
# uses: sigstore/cosign-installer@7e0881f8fe90b25e305bbf0309761e9314607e25
45+
# with:
46+
# cosign-release: 'v1.9.0'
47+
48+
49+
# Workaround: https://github.com/docker/build-push-action/issues/461
50+
- name: Setup Docker buildx
51+
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
52+
53+
# Login against a Docker registry except on PR
54+
# https://github.com/docker/login-action
55+
- name: Log into registry ${{ env.REGISTRY }}
56+
if: github.event_name != 'pull_request'
57+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
58+
with:
59+
registry: ${{ env.REGISTRY }}
60+
username: ${{ github.actor }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
62+
63+
# Extract metadata (tags, labels) for Docker
64+
# https://github.com/docker/metadata-action
65+
- name: Extract Docker metadata
66+
id: meta
67+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
68+
with:
69+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
70+
71+
- id: prep
72+
if: "startsWith(github.ref, 'refs/tags/')"
73+
run: |
74+
echo ::set-output name=tags::${GITHUB_REF#refs/tags/v}
75+
env:
76+
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
77+
78+
79+
80+
# Build and push Docker image with Buildx (don't push on PR)
81+
# https://github.com/docker/build-push-action
82+
- name: Build and push Docker image
83+
id: build-and-push
84+
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
85+
with:
86+
context: .
87+
push: ${{ github.event_name != 'pull_request' }}
88+
tags: ${{ steps.meta.outputs.tags }}
89+
labels: ${{ steps.meta.outputs.labels }}
90+
91+
# Sign the resulting Docker image digest except on PRs.
92+
# This will only write to the public Rekor transparency log when the Docker
93+
# repository is public to avoid leaking data. If you would like to publish
94+
# transparency data even for private images, pass --force to cosign below.
95+
# https://github.com/sigstore/cosign
96+
# - name: Sign the published Docker image
97+
# if: ${{ github.event_name != 'pull_request' }}
98+
# env:
99+
# COSIGN_EXPERIMENTAL: "true"
100+
# # This step uses the identity token to provision an ephemeral certificate
101+
# # against the sigstore community Fulcio instance.
102+
# run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}

.gitignore

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# App and ide specific
2+
/etc/*.yml
3+
/*.obj
4+
/downloads/*
5+
/logs/*
6+
/examples/*
7+
/.idea/*
8+
/schedules/*
9+
*.wpr
10+
*.wpu
11+
.idea/
12+
/.idea/
13+
.idea/
14+
15+
# Byte-compiled / optimized / DLL files
16+
__pycache__/
17+
*.pyc
18+
*.py[cod]
19+
*$py.class
20+
21+
# C extensions
22+
*.so
23+
24+
# Distribution / packaging
25+
.Python
26+
env/
27+
develop-eggs/
28+
dist/
29+
downloads/
30+
eggs/
31+
.eggs/
32+
parts/
33+
sdist/
34+
var/
35+
wheels/
36+
*.egg-info/
37+
.installed.cfg
38+
*.egg
39+
40+
# PyInstaller
41+
# Usually these files are written by a python script from a template
42+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
43+
*.manifest
44+
*.spec
45+
46+
# Installer logs
47+
pip-log.txt
48+
pip-delete-this-directory.txt
49+
50+
# Unit test / coverage reports
51+
htmlcov/
52+
.tox/
53+
.coverage
54+
.coverage.*
55+
.cache
56+
nosetests.xml
57+
coverage.xml
58+
*.cover
59+
.hypothesis/
60+
61+
# Translations
62+
*.mo
63+
*.pot
64+
65+
# Django stuff:
66+
*.log
67+
local_settings.py
68+
69+
# Flask stuff:
70+
instance/
71+
.webassets-cache
72+
73+
# Scrapy stuff:
74+
.scrapy
75+
76+
# Sphinx documentation
77+
docs/_build/
78+
79+
# PyBuilder
80+
target/
81+
82+
# Jupyter Notebook
83+
.ipynb_checkpoints
84+
85+
# pyenv
86+
.python-version
87+
88+
# celery beat schedule file
89+
celerybeat-schedule
90+
91+
# SageMath parsed files
92+
*.sage.py
93+
94+
# dotenv
95+
.env
96+
97+
# virtualenv
98+
.venv
99+
venv/
100+
ENV/
101+
102+
# Spyder project settings
103+
.spyderproject
104+
.spyproject
105+
106+
# Rope project settings
107+
.ropeproject
108+
109+
# mkdocs documentation
110+
/site
111+
112+
# mypy
113+
.mypy_cache/
114+
115+
/stubs/

.gitlab-ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
include:
2+
- project: 'kelvin/_templates'
3+
file: 'docker-build-ci.yml'
4+
5+
# This specific template is located at:
6+
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Docker.gitlab-ci.yml
7+
8+
stages:
9+
- notify_start
10+
- build
11+
- notify

.onedev-buildspec.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: 15
2+
jobs:
3+
- name: qtool-build
4+
jobExecutor: localdocker
5+
steps:
6+
- !CheckoutStep
7+
name: checkout
8+
cloneCredential: !DefaultCredential {}
9+
withLfs: false
10+
withSubmodules: false
11+
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
12+
- !CommandStep
13+
name: build-it
14+
runInContainer: true
15+
image: dp.prjx.uk/docker:20.10
16+
interpreter: !DefaultInterpreter
17+
commands:
18+
- docker build -t nexus.prjx.uk/repository/qtool-od:@tag@ .
19+
- docker login -u admin -p @secrets:nexus-password@ https://nexus.prjx.uk/repository/
20+
- docker push nexus.prjx.uk/repository/qtool-od:@tag@
21+
useTTY: false
22+
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
23+
triggers:
24+
- !TagCreateTrigger
25+
projects: QTool
26+
retryCondition: never
27+
maxRetries: 3
28+
retryDelay: 30
29+
cpuRequirement: 500
30+
memoryRequirement: 256
31+
timeout: 3600

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Build: docker build --force-rm --no-cache -t "qtool" .
2+
## Run Interactive: docker run -it qtool
3+
## Run Interactive: docker run -it qtool /bin/bash
4+
## Run Daemon: docker run -d qtool
5+
## apt-get install --reinstall ca-certificates
6+
7+
## Debian-base build...
8+
FROM python:3.10.6-slim-buster
9+
ADD . /app
10+
RUN pip install -r /app/requirements.txt
11+
CMD ["python3", "/app/qtool.py", "exec", "scheduler"]
12+
13+
##
14+
### Alpine Linux build...
15+
# FROM python:3.10.6-alpine3.16
16+
# RUN set -ex && apk add --no-cache gcc libc-dev
17+
# ADD . /app
18+
# RUN pip install -r /app/requirements.txt
19+
# CMD ["python3", "/app/qtool.py", "exec", "scheduler"]
20+
21+

0 commit comments

Comments
 (0)