-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Restructure repository files * Add docker setup * Add github action * Use env variables * Add Intellij IDEA dir to .gitignore
- Loading branch information
1 parent
085a63d
commit 2c04535
Showing
42 changed files
with
255 additions
and
32 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,100 @@ | ||
name: Docker | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
on: | ||
schedule: | ||
- cron: '36 21 * * *' | ||
push: | ||
branches: [ "main" ] | ||
# Publish semver tags as releases. | ||
tags: [ 'v*.*.*' ] | ||
pull_request: | ||
branches: [ "main" ] | ||
workflow_dispatch: | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
# Install the cosign tool except on PR | ||
# https://github.com/sigstore/cosign-installer | ||
- name: Install cosign | ||
if: github.event_name != 'pull_request' | ||
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1 | ||
with: | ||
cosign-release: 'v2.1.1' | ||
|
||
# Workaround: https://github.com/docker/build-push-action/issues/461 | ||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
|
||
# Sign the resulting Docker image digest except on PRs. | ||
# This will only write to the public Rekor transparency log when the Docker | ||
# repository is public to avoid leaking data. If you would like to publish | ||
# transparency data even for private images, pass --force to cosign below. | ||
# https://github.com/sigstore/cosign | ||
- name: Sign the published Docker image | ||
if: ${{ github.event_name != 'pull_request' }} | ||
env: | ||
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable | ||
TAGS: ${{ steps.meta.outputs.tags }} | ||
DIGEST: ${{ steps.build-and-push.outputs.digest }} | ||
# This step uses the identity token to provision an ephemeral certificate | ||
# against the sigstore community Fulcio instance. | ||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
__pycache__ | ||
*.pyc | ||
/*.egg-info | ||
/build | ||
/dist | ||
/src/build | ||
/src/dist | ||
/db | ||
*.log | ||
.idea |
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
[submodule "bootstrap"] | ||
path = bootstrap | ||
[submodule "src/bootstrap"] | ||
path = src/bootstrap | ||
url = https://github.com/twbs/bootstrap.git | ||
[submodule "EncryptedSession"] | ||
path = EncryptedSession | ||
url = https://github.com/SaintFlipper/EncryptedSession.git | ||
[submodule "gnucash"] | ||
path = gnucash | ||
[submodule "src/EncryptedSession"] | ||
path = src/EncryptedSession | ||
url = https://github.com/SaintFlipper/EncryptedSession.git | ||
[submodule "src/gnucash"] | ||
path = src/gnucash | ||
url = https://github.com/Gnucash/gnucash | ||
[submodule "selectize"] | ||
path = selectize | ||
[submodule "src/selectize"] | ||
path = src/selectize | ||
url = https://github.com/selectize/selectize.js.git | ||
[submodule "bootstrap-icons"] | ||
path = bootstrap-icons | ||
[submodule "src/bootstrap-icons"] | ||
path = src/bootstrap-icons | ||
url = https://github.com/twbs/icons.git |
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,38 @@ | ||
FROM python:alpine AS builder | ||
LABEL authors="freddo" | ||
|
||
WORKDIR /srv/ | ||
|
||
RUN apk add \ | ||
gcc \ | ||
musl-dev \ | ||
mariadb-dev \ | ||
python3-dev \ | ||
libpq-dev | ||
|
||
RUN pip wheel --no-cache-dir --wheel-dir /wheels mysql pycryptodome psycopg2 | ||
|
||
FROM python:alpine | ||
|
||
WORKDIR /srv/ | ||
|
||
COPY ./src/ ./ | ||
COPY ./README.md ./ | ||
COPY --from=builder /wheels /wheels | ||
|
||
RUN apk add libpq mariadb-client | ||
RUN pip install -v --no-cache /wheels/* .[pgsql,mysql] gunicorn | ||
RUN rm -r /wheels | ||
|
||
EXPOSE 8000 | ||
|
||
ENV SECRET_KEY='00000000000000000000000000000000' | ||
ENV LOG_LEVEL='WARN' | ||
ENV DB_DRIVER='sqlite' | ||
ENV DB_NAME='/gnucash.sqlite' | ||
ENV DB_HOST='localhost' | ||
ENV AUTH_MECHANISM='' | ||
ENV TRANSACTION_PAGE_LENGTH=25 | ||
ENV PRESELECTED_CONTRA_ACCOUNT='' | ||
|
||
ENTRYPOINT ["gunicorn", "-b", "0.0.0.0", "gnucash_web.wsgi:app"] |
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
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,32 @@ | ||
version: '3.11' | ||
|
||
services: | ||
db: | ||
image: postgres:15-alpine | ||
environment: | ||
POSTGRES_USER: 'user' | ||
POSTGRES_DB: 'gnucash' | ||
POSTGRES_PASSWORD: 'example' | ||
volumes: | ||
- db-data:/var/lib/postgresql/data | ||
app: | ||
image: ghcr.io/joshuabach/gnucash-web:main | ||
environment: | ||
SECRET_KEY: '00000000000000000000000000000000' | ||
|
||
LOG_LEVEL: 'WARN' | ||
|
||
DB_DRIVER: 'postgres' | ||
DB_NAME: 'gnucash' | ||
DB_HOST: 'db' | ||
|
||
AUTH_MECHANISM: 'passthrough' | ||
|
||
TRANSACTION_PAGE_LENGTH: 25 | ||
PRESELECTED_CONTRA_ACCOUNT: | ||
|
||
ports: | ||
- "8000:8000" | ||
|
||
volumes: | ||
db-data: |
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,22 @@ | ||
version: '3.11' | ||
|
||
services: | ||
app: | ||
image: ghcr.io/joshuabach/gnucash-web:main | ||
environment: | ||
SECRET_KEY: '00000000' | ||
|
||
LOG_LEVEL: 'WARN' | ||
|
||
DB_DRIVER: 'sqlite' | ||
DB_NAME: '/gnucash.sqlite' | ||
|
||
AUTH_MECHANISM: | ||
|
||
TRANSACTION_PAGE_LENGTH: 25 | ||
PRESELECTED_CONTRA_ACCOUNT: | ||
|
||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- ./sample/sample.sqlite:/gnucash.sqlite |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Submodule EncryptedSession
updated
from 000000 to cfc0f9
Submodule bootstrap
updated
from 000000 to 60714e
Submodule bootstrap-icons
updated
from 000000 to d5aa18
File renamed without changes.
Submodule gnucash
updated
from 000000 to 6df866
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,16 @@ | ||
"""Default GnuCash Web configuration.""" | ||
import logging | ||
import os | ||
|
||
SECRET_KEY = bytes.fromhex(os.getenv('SECRET_KEY', '00000000')) | ||
|
||
LOG_LEVEL = logging.getLevelName(os.getenv('LOG_LEVEL', 'WARN')) | ||
|
||
DB_DRIVER = os.getenv('DB_DRIVER', 'sqlite') | ||
DB_NAME = os.getenv('DB_NAME', 'db/gnucash.sqlite') | ||
DB_HOST = os.getenv('DB_HOST', 'localhost') | ||
|
||
AUTH_MECHANISM = os.getenv('AUTH_MECHANISM') | ||
|
||
TRANSACTION_PAGE_LENGTH = int(os.getenv('TRANSACTION_PAGE_LENGTH', 25)) | ||
PRESELECTED_CONTRA_ACCOUNT = os.getenv('PRESELECTED_CONTRA_ACCOUNT') |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Flask==2.0.2 | ||
mysql==0.0.3 | ||
piecash==1.2.0 | ||
pycryptodome==3.12.0 | ||
pycryptodome==3.18.0 | ||
babel==2.9.1 | ||
requests==2.27.1 |
Submodule selectize
updated
from 000000 to 048897
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