Skip to content

Commit

Permalink
build: apply project template
Browse files Browse the repository at this point in the history
  • Loading branch information
Donald Mellenbruch authored and Donald Mellenbruch committed Jun 21, 2023
1 parent 9de76ae commit b1f3a0d
Show file tree
Hide file tree
Showing 52 changed files with 1,741 additions and 10,438 deletions.
13 changes: 13 additions & 0 deletions .bumpversion.cfg
@@ -0,0 +1,13 @@
[bumpversion]
current_version = 0.3.0
commit = False
message = bump: {current_version} --> {new_version}
tag = False
tag_name = {current_version}
tag_message =
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<rc_kind>[A-Za-z]*)(?P<rc>\d*)
serialize =
{major}.{minor}.{patch}{rc_kind}{rc}
{major}.{minor}.{patch}

[bumpversion:glob:src/*/__version__.py]
21 changes: 21 additions & 0 deletions .copier-answers.yml
@@ -0,0 +1,21 @@
# Changes here will be overwritten by Copier
_commit: a093063
_src_path: https://codeberg.org/Fresh2dev/copier-f2dv-project.git
author_email: hello@Fresh2.dev
author_name: Donald Mellenbruch
ci_domain_name: lokalhost.net
docs_url: https://www.Fresh2.dev/code/r/ezpq/i
funding_url: https://www.Fresh2.dev/funding
home_page: https://www.Fresh2.dev
is_minimal: false
is_python: true
license_type: GPLv3
package_name: ezpq
project_description: None
project_name: ezpq
python_version: '3.7'
repo_mirror: https://www.Fresh2.dev/code/r/ezpq
repo_name: fresh2dev/ezpq
repo_owner: fresh2dev
repo_url: https://www.github.com/fresh2dev/ezpq

14 changes: 14 additions & 0 deletions .dockerignore
@@ -0,0 +1,14 @@
**/.git

**/secrets
!**/*.keep
**/*.tmp/build
**/.coverage
**/.hypothesis
**/.tox
**/.idea
**/.vscode
**/*.egg-info
**/.mypy_cache
**/__pycache__
**/.pytest_cache
158 changes: 116 additions & 42 deletions .drone.yml
@@ -1,75 +1,149 @@
kind: template
load: deploythatapp.jsonnet
load: hostbutter.jsonnet
data:
projectName: ${DRONE_REPO}
gitSshKey: default
ciImageRegistry: "registry.lokalhost.net"
domains: >-
["lokalhost.net", "fresh2.dev"]
["lokalhost.net"]
domainTriggers: >-
{
"lokalhost.net": {
"branch": ["main", "master"],
"event": ["push", "custom"]
},
"fresh2.dev": {
"event": ["tag"]
}
"lokalhost.net": {}
}
imageTags: ""
useDinD: false
publishDockerHub: false
deployStack: true
deployCommands: >-
domainClusterMap: >-
{}
publishRegistries: >-
{}
secrets: >-
[]
secretFiles: >-
{}
volumes: >-
[]
domainVars: >-
{
"lokalhost.net": {
"PYPI_CREDS": {"from_secret": "lokalhost.net_pypi-creds"}
}
"ENV_FILE": ".env"
}
volumes: >-
[]
beforeSteps: >-
[
{
"name": "run-tests",
"image": "registry.lokalhost.net/python:3.9-buster",
"commands": ["make test", "make build-docs"],
"when": {
"event": ["push", "custom", "tag"]
}
"name": "py-test",
"image": "registry.lokalhost.net/fresh2dev/mykefiles:5de40c3",
"environment": {
"PIP_CONF": {"from_secret": "PIP_CONF"},
"MYKE_MODULE": "mykefiles.python"
},
"commands": [
"mkdir -p ~/.config/pip && echo \"$PIP_CONF\" > ~/.config/pip/pip.conf",
"myke py-install",
"myke py-reports",
"myke py-build"
],
"when": {}
}
]
afterSteps: >-
[]
finalSteps: >-
[
{
"name": "publish-testpypi",
"image": "registry.lokalhost.net/python:3.9-buster",
"name": "py-build-package",
"image": "registry.lokalhost.net/fresh2dev/mykefiles:5de40c3",
"environment": {
"PYPI_CREDS": {"from_secret": "PYPI_CREDS"},
"PIP_CONF": {"from_secret": "PIP_CONF"},
"MYKE_MODULE": "mykefiles.python"
},
"commands": [
"echo -n \"$PYPI_CREDS\" > ~/.pypirc",
"make publish"
"echo \"$PYPI_CREDS\" > ~/.pypirc",
"mkdir -p ~/.config/pip && echo \"$PIP_CONF\" > ~/.config/pip/pip.conf",
"myke py-version-set --repository lokalhost",
"myke py-build"
],
"when": {}
},
{
"name": "py-publish-sandbox",
"image": "registry.lokalhost.net/fresh2dev/mykefiles:5de40c3",
"environment": {
"PYPI_CREDS": {"from_secret": "PYPI_CREDS"},
"PIP_CONF": {"from_secret": "PIP_CONF"},
"TWINE_CERT": "/etc/ssl/certs/ca-certificates.crt",
"MYKE_MODULE": "mykefiles.python"
},
"commands": [
"echo \"$PYPI_CREDS\" > ~/.pypirc",
"mkdir -p ~/.config/pip && echo \"$PIP_CONF\" > ~/.config/pip/pip.conf",
"myke py-publish --repository lokalhost"
],
"when": {}
},
{
"name": "py-publish-dev",
"image": "registry.lokalhost.net/fresh2dev/mykefiles:5de40c3",
"environment": {
"PYPI_CREDS": {"from_secret": "PYPI_CREDS"},
"PIP_CONF": {"from_secret": "PIP_CONF"},
"TWINE_CERT": "/etc/ssl/certs/ca-certificates.crt",
"MYKE_MODULE": "mykefiles.python"
},
"commands": [
"echo \"$PYPI_CREDS\" > ~/.pypirc",
"mkdir -p ~/.config/pip && echo \"$PIP_CONF\" > ~/.config/pip/pip.conf",
"myke py-publish --repository codeberg"
],
"when": {
"ref": ["refs/heads/dev", "refs/heads/main", "refs/tags/*"]
}
},
{
"name": "py-publish-test",
"image": "registry.lokalhost.net/fresh2dev/mykefiles:5de40c3",
"environment": {
"PYPI_CREDS": {"from_secret": "PYPI_CREDS"},
"PIP_CONF": {"from_secret": "PIP_CONF"},
"TWINE_CERT": "/etc/ssl/certs/ca-certificates.crt",
"MYKE_MODULE": "mykefiles.python"
},
"commands": [
"echo \"$PYPI_CREDS\" > ~/.pypirc",
"mkdir -p ~/.config/pip && echo \"$PIP_CONF\" > ~/.config/pip/pip.conf",
"myke py-publish --repository testpypi"
],
"when": {
"branch": ["main", "master"],
"event": ["push", "custom"]
"ref": ["refs/tags/*"]
}
},
{
"name": "publish-pypi",
"image": "registry.lokalhost.net/python:3.9-buster",
"name": "py-publish-prod",
"image": "registry.lokalhost.net/fresh2dev/mykefiles:5de40c3",
"environment": {
"PYPI_CREDS": {"from_secret": "PYPI_CREDS"},
"PIP_CONF": {"from_secret": "PIP_CONF"},
"TWINE_CERT": "/etc/ssl/certs/ca-certificates.crt",
"MYKE_MODULE": "mykefiles.python"
},
"commands": [
"echo -n \"$PYPI_CREDS\" > ~/.pypirc",
"VERSION=${DRONE_TAG} make publish-prod"
"echo \"$PYPI_CREDS\" > ~/.pypirc",
"mkdir -p ~/.config/pip && echo \"$PIP_CONF\" > ~/.config/pip/pip.conf",
"myke py-publish --repository pypi"
],
"when": {
"event": ["tag"]
"ref": ["refs/tags/*"]
}
}
]
extraObjects: >-
[]
[
{
"kind": "secret",
"name": "PYPI_CREDS",
"get": {
"path": "secret/data/hostbutter/global",
"name": "PYPI_CREDS"
}
},
{
"kind": "secret",
"name": "PIP_CONF",
"get": {
"path": "secret/data/hostbutter/global",
"name": "PIP_CONF"
}
}
]
14 changes: 8 additions & 6 deletions .env
Expand Up @@ -2,17 +2,19 @@
COMPOSE_PROJECT_NAME=ezpq

### GLOBAL VARIABLES
DOMAIN=
PUBLIC_NETWORK=
NFS_OPTS=
IMAGE_REGISTRY=
HB_DOMAIN=
HB_PROXY_NETWORK=
HB_NFS_OPTS=
HB_IMAGE_REGISTRY=

### PROJECT VARIABLES

## APP
APP_SVC_ID=app
APP_SUBDOMAIN=ezpq.
APP_ROUTE_PREFIX=
APP_STRIP_PREFIX=
# APP_STRIP_PREFIX=
APP_HTTP_PORT=80
APP_PLACEMENT_LABEL=app-server
APP_PLACEMENT_LABEL=frontend

PYTHONPATH=src
34 changes: 22 additions & 12 deletions .gitignore
@@ -1,12 +1,22 @@
*.csv
*.egg-info
*.pyc
.Rhistory
.idea
.ipynb_checkpoints
.mypy_cache
.pytest_cache
.vscode
__pycache__
build
dist
**/secrets
!**/*.keep
**/*.tmp
.python-version

/public

/requirements.txt
/dist
/build

**/.coverage
**/.hypothesis
**/.tox
**/.idea
**/.vscode
**/*.egg-info
**/.mypy_cache
**/__pycache__
**/.pytest_cache
**/.ropeproject
**/.ruff_cache
1 change: 1 addition & 0 deletions .python-base-version
@@ -0,0 +1 @@
3.7.16
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -43,4 +43,4 @@

## v0.1.0

- Initial release
- Initial release
26 changes: 23 additions & 3 deletions Dockerfile
@@ -1,4 +1,24 @@
ARG IMAGE_REGISTRY=docker.io
FROM ${IMAGE_REGISTRY}/nginx:1
ARG HB_IMAGE_REGISTRY=docker.io
FROM ${HB_IMAGE_REGISTRY}/python:3.10.10-slim-bullseye as build
LABEL org.opencontainers.image.source=https://www.github.com/fresh2dev/ezpq
LABEL org.opencontainers.image.description="None"
LABEL org.opencontainers.image.licenses=GPLv3
RUN apt-get update && apt-get install --upgrade -y build-essential git
WORKDIR /app
ENV PYTHONUNBUFFERED=1
RUN python3 -m venv /app/venv
ENV PATH="/app/venv/bin:$PATH"
RUN python3 -m pip install --no-cache-dir --upgrade pip
COPY ./dist /dist
RUN find /dist -name "*.whl" -exec \
pip install --no-cache-dir \
--extra-index-url "https://codeberg.org/api/packages/Fresh2dev/pypi/simple" \
"{}" \; \
&& pip show "ezpq"

COPY public /usr/share/nginx/html
FROM ${HB_IMAGE_REGISTRY}/python:3.10.10-slim-bullseye
COPY --from=build /app/venv /app/venv
COPY --from=build /usr/local/bin /usr/local/bin
ENV PATH="/app/venv/bin:$PATH"
ENTRYPOINT ["ezpq"]
WORKDIR /workspace
7 changes: 7 additions & 0 deletions Dockerfile-docs
@@ -0,0 +1,7 @@
ARG HB_IMAGE_REGISTRY=docker.io
FROM ${HB_IMAGE_REGISTRY}/nginx:1
LABEL org.opencontainers.image.source=https://www.github.com/fresh2dev/ezpq
LABEL org.opencontainers.image.description="None"
LABEL org.opencontainers.image.licenses=GPLv3
ARG CONTENT_PATH=public
COPY $CONTENT_PATH /usr/share/nginx/html

0 comments on commit b1f3a0d

Please sign in to comment.