-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9f7e03f
Showing
24 changed files
with
4,471 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.vscode | ||
.env | ||
.git | ||
README.md | ||
CHANGELOG.md | ||
|
||
# Python | ||
.venv/ | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Application | ||
LISTEN_ADDRESS=0.0.0.0 | ||
LISTEN_PORT=5000 | ||
LOG_LEVEL=info | ||
SECRET_KEY=secret | ||
QUEUE_RESULT_TTL=7200 | ||
|
||
# GitLab | ||
GITLAB_URL= | ||
GITLAB_TOKEN= | ||
GITLAB_SKIP_USERS=740 | ||
|
||
# SonmarQube | ||
SONARQUBE_URL= | ||
SONARQUBE_TOKEN= | ||
SONARQUBE_ALM_KEY=GitLab | ||
SONARQUBE_SKIP_GROUPS= | ||
|
||
# Redis | ||
REDIS_URL=redis://localhost:6379/0 | ||
|
||
# Prometheus metrics | ||
EXPORTER_LISTEN_ADDRESS=0.0.0.0 | ||
EXPORTER_LISTEN_PORT=9726 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Publish Docker image | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*.**.**' | ||
paths-ignore: | ||
- '**.md' | ||
- '**.png' | ||
- '**.jpg' | ||
- '**.svg' | ||
- '**.json' | ||
- CNAME | ||
- LICENSE | ||
|
||
jobs: | ||
push_to_registries: | ||
name: Push Docker image to multiple registries | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Log in to Docker Hub Container registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Log in to Quay Container registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: quay.io | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Log in to GitHub Container registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: | | ||
${{ github.repository }} | ||
quay.io/${{ github.repository }} | ||
ghcr.io/${{ github.repository }} | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Set env | ||
id: env | ||
run: | | ||
echo ::set-output name=PROJECT_NAME::${GITHUB_REF#refs/*/} | ||
echo ::set-output name=PROJECT_BRANCH::${GITHUB_REF#refs/heads/} | ||
echo ::set-output name=PROJECT_TAG::${GITHUB_REF#refs/tags/} | ||
- name: Create Release | ||
id: create_release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: | | ||
Pull image: | ||
* `docker pull ghcr.io/woozymasta/guassp:${{ steps.env.outputs.PROJECT_TAG }}` | ||
* `docker pull quay.io/woozymasta/guassp:${{ steps.env.outputs.PROJECT_TAG }}` | ||
* `docker pull docker.io/woozymasta/guassp:${{ steps.env.outputs.PROJECT_TAG }}` | ||
draft: false | ||
prerelease: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.env | ||
|
||
# Python | ||
.venv/ | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[BASIC] | ||
good-names=sq, gl, e, q |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"recommendations": [ | ||
"ms-python.python", | ||
"woozy-masta.shell-script-ide", | ||
"davidanson.vscode-markdownlint", | ||
"yzhang.markdown-all-in-one", | ||
"stkb.rewrap" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "App", | ||
"type": "python", | ||
"request": "launch", | ||
"module": "flask", | ||
"env": { | ||
"FLASK_APP": "app.py", | ||
"FLASK_ENV": "development" | ||
}, | ||
"args": [ | ||
"run", | ||
"--no-debugger" | ||
], | ||
"jinja": true | ||
}, | ||
{ | ||
"name": "Worker", | ||
"type": "python", | ||
"request": "launch", | ||
"program": "worker.py", | ||
"console": "integratedTerminal", | ||
"env": { | ||
"LOG_LEVEL": "info" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.DS_Store": true, | ||
"**/.venv": true, | ||
"**/__pycache__": true, | ||
}, | ||
"workbench.colorCustomizations": { | ||
"statusBar.background": "#1e0436", | ||
"statusBar.foreground": "#ceabd4", | ||
"statusBarItem.hoverBackground": "#480b4d93", | ||
"statusBarItem.activeBackground": "#d405c391" | ||
}, | ||
"files.eol": "\n", | ||
"files.insertFinalNewline": true, | ||
"files.trimFinalNewlines": true, | ||
"files.trimTrailingWhitespace": true, | ||
"markdown.extension.toc.levels": "1..2", | ||
"markdown.extension.toc.unorderedList.marker": "*", | ||
"markdown-preview-enhanced.previewTheme": "github-light.css", | ||
"markdown-preview-enhanced.breakOnSingleNewLine": false, | ||
"rewrap.autoWrap.enabled": true, | ||
"editor.renderWhitespace": "boundary", | ||
"editor.insertSpaces": true, | ||
"editor.rulers": [ | ||
{ | ||
"column": 72, | ||
"color": "#1e751633", | ||
}, | ||
{ | ||
"column": 80, | ||
"color": "#c2790b99", | ||
} | ||
], | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.python", | ||
"editor.tabSize": 4, | ||
"editor.wordWrap": "off", | ||
"editor.minimap.maxColumn": 132 | ||
}, | ||
"[shellscript]": { | ||
"editor.tabSize": 2, | ||
"editor.wordWrap": "off", | ||
"editor.minimap.maxColumn": 132, | ||
"editor.language.brackets": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["[[", "]]"], | ||
["(", ")"] | ||
], | ||
}, | ||
"[markdown]": { | ||
"files.trimTrailingWhitespace": false, | ||
"editor.defaultFormatter": "yzhang.markdown-all-in-one" | ||
}, | ||
"python.linting.ignorePatterns": [ | ||
".vscode/*.py", | ||
"**/extra/**/*.py", | ||
"**/.venv/**/*.py" | ||
], | ||
"python.defaultInterpreterPath": "./.venv/bin/python", | ||
"python.linting.pylintEnabled": true, | ||
"python.linting.enabled": true, | ||
"python.linting.flake8Enabled": false, | ||
"python.linting.banditEnabled": false, | ||
"python.linting.pydocstyleEnabled": false, | ||
"python.linting.pycodestyleEnabled": false, | ||
"python.linting.prospectorEnabled": false, | ||
"python.linting.mypyEnabled": false, | ||
"python.formatting.provider": "autopep8", | ||
"python.formatting.autopep8Args": ["--max-line-length", "80", "--experimental"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Define base images and tags | ||
# --------------------------- | ||
ARG DOCKERFILE_BUILD_IMAGE="docker.io/python" | ||
ARG DOCKERFILE_BUILD_TAG="3.10.0-bullseye" | ||
ARG DOCKERFILE_BASE_IMAGE="docker.io/python" | ||
ARG DOCKERFILE_BASE_TAG="3.10.0-slim-bullseye" | ||
|
||
|
||
# Prepare venv | ||
# ------------ | ||
FROM $DOCKERFILE_BUILD_IMAGE:$DOCKERFILE_BUILD_TAG AS build | ||
WORKDIR "/app" | ||
|
||
# Need for caching proxy | ||
ARG PIP_INDEX_URL=https://pypi.org/simple/ | ||
ARG PIP_INDEX=https://pypi.org/pypi/ | ||
|
||
# Install dependecies | ||
# hadolint ignore=DL3015,DL3008,DL3013,DL3042 | ||
RUN set -eux && \ | ||
apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
python3-dev gcc libc-dev libev-dev libevdev2 && \ | ||
python -m pip install --no-cache-dir --upgrade --force --ignore-installed pip && \ | ||
pip install --no-cache-dir --upgrade --upgrade-strategy eager wheel && \ | ||
python -m venv .venv | ||
|
||
# Install python dependecies | ||
COPY requirements.txt . | ||
ENV PATH "/app/.venv/bin:/app:$PATH" | ||
|
||
RUN set -eux && \ | ||
pip install --no-cache-dir --requirement requirements.txt | ||
|
||
# Copy scripts | ||
COPY guassp.sh ./guassp | ||
COPY app.py worker.py wsgi.py ./ | ||
|
||
|
||
# Make app image | ||
# -------------- | ||
FROM $DOCKERFILE_BUILD_IMAGE:$DOCKERFILE_BUILD_TAG | ||
WORKDIR "/app" | ||
|
||
# hadolint ignore=DL3008 | ||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y libev-dev libevdev2 && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy components | ||
COPY --from=build /app /app | ||
|
||
ENTRYPOINT ["/app/guassp"] |
Oops, something went wrong.