diff --git a/.env.example b/.env.example deleted file mode 100644 index d5ed451..0000000 --- a/.env.example +++ /dev/null @@ -1,5 +0,0 @@ -KOITO_ALLOWED_HOSTS=* -KOITO_LOG_LEVEL=debug -KOITO_CONFIG_DIR=test_config_dir -KOITO_DATABASE_URL=postgres://postgres:secret@localhost:5432?sslmode=disable -TZ=Etc/UTC diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index fbf205d..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -# These are supported funding model platforms - -ko_fi: gabehf diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md deleted file mode 100644 index 677ad0c..0000000 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "[Bug] " -labels: bug -assignees: gabehf - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots/Logs** -If applicable, add screenshots to help explain your problem and any relevant logs with `KOITO_LOG_LEVEL=debug` if possible. - -**Version (please complete the following information):** - - Koito version: v0.0.X - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 34ecdf9..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: "[Enhancement] " -labels: enhancement -assignees: gabehf - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Why would you like this feature to be added?** -A clear description of why this feature might be useful for you will help inform development decisions. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/astro.yml b/.github/workflows/astro.yml index 428b7b8..2da5fc4 100644 --- a/.github/workflows/astro.yml +++ b/.github/workflows/astro.yml @@ -2,13 +2,10 @@ name: Deploy to GitHub Pages on: push: - tags: - - "v*" + branches: [main] paths: - - "docs/**" - - ".github/workflows/**" - - workflow_dispatch: + - 'docs/**' + - '.github/workflows/**' permissions: contents: read @@ -24,9 +21,9 @@ jobs: - name: Install, build, and upload your site output uses: withastro/action@v4 with: - path: ./docs # The root location of your Astro project inside the repository. (optional) - node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 22. (optional) - package-manager: yarn@1.22.22 # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional) + path: ./docs # The root location of your Astro project inside the repository. (optional) + node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 22. (optional) + package-manager: yarn@1.22.22 # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional) deploy: needs: build @@ -37,4 +34,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 466a4f6..cd7ecb0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,64 +12,66 @@ name: Publish Docker image on: push: tags: - - "v*" - branches: - - main - paths-ignore: - - "docs/**" - - "README.md" - - workflow_dispatch: + - 'v*' jobs: test: name: Go Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod - - name: Install libvips - run: | - sudo apt-get update - sudo apt-get install -y libvips-dev + - name: Install libvips + run: | + sudo apt-get update + sudo apt-get install -y libvips-dev - - name: Verify libvips install - run: vips --version + - name: Verify libvips install + run: vips --version - - name: Build - run: go build -v ./... + - name: Build + run: go build -v ./... - - name: Test - uses: robherley/go-test-action@v0 + - name: Test + uses: robherley/go-test-action@v0 push_to_registry: - name: Push Docker image to Docker Hub (release) - if: startsWith(github.ref, 'refs/tags/') + name: Push Docker image to Docker Hub needs: test runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + id-token: write steps: - - uses: actions/checkout@v4 + - name: Check out the repo + uses: actions/checkout@v4 - name: Log in to Docker Hub - uses: docker/login-action@v3 + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: gabehf/koito - name: Extract tag version + id: extract_version run: echo "KOITO_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - - name: Build and push release image + - name: Build and push Docker image id: push - uses: docker/build-push-action@v6 + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 with: context: . file: ./Dockerfile @@ -79,34 +81,10 @@ jobs: gabehf/koito:${{ env.KOITO_VERSION }} build-args: | KOITO_VERSION=${{ env.KOITO_VERSION }} - platforms: linux/amd64,linux/arm64 - push_dev: - name: Push Docker image (dev branch) - if: github.ref == 'refs/heads/main' - needs: test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push dev image - uses: docker/build-push-action@v6 - with: - context: . - file: ./Dockerfile - push: true - tags: | - gabehf/koito:dev - gabehf/koito:dev-${{ github.sha }} - build-args: | - KOITO_VERSION=dev - platforms: linux/amd64,linux/arm64 + subject-name: index.docker.io/gabehf/koito + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index f37ea6a..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Test - -on: - pull_request: - branches: - - main - -jobs: - test: - name: Go Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - - name: Install libvips - run: | - sudo apt-get update - sudo apt-get install -y libvips-dev - - - name: Verify libvips install - run: vips --version - - - name: Build - run: go build -v ./... - - - name: Test - uses: robherley/go-test-action@v0 diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 083bb78..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -test_config_dir -.env diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9eb9f33 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# v0.0.4 +## Enhancements +- Re-download images missing from cache on request diff --git a/Dockerfile b/Dockerfile index 72fd522..3c95c9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ COPY ./client . RUN yarn run build -FROM golang:1.24 AS backend +FROM golang:1.23 AS backend ARG KOITO_VERSION ENV CGO_ENABLED=1 diff --git a/Makefile b/Makefile index 99455ac..78c1fb0 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,3 @@ -ifneq (,$(wildcard ./.env)) - include .env - export -endif - .PHONY: all test clean client postgres.schemadump: @@ -15,10 +10,7 @@ postgres.schemadump: -v --dbname="koitodb" -f "/tmp/dump/schema.sql" postgres.run: - docker run --name koito-db -p 5432:5432 -v koito_dev_db:/var/lib/postgresql -e POSTGRES_PASSWORD=secret -d postgres - -postgres.run-scratch: - docker run --name koito-scratch -p 5433:5432 -e POSTGRES_PASSWORD=secret -d postgres + docker run --name koito-db -p 5432:5432 -e POSTGRES_PASSWORD=secret -d postgres postgres.start: docker start koito-db @@ -26,17 +18,8 @@ postgres.start: postgres.stop: docker stop koito-db -postgres.remove: - docker stop koito-db && docker rm koito-db - -postgres.remove-scratch: - docker stop koito-scratch && docker rm koito-scratch - -api.debug: postgres.start - go run cmd/api/main.go - -api.scratch: postgres.run-scratch - KOITO_DATABASE_URL=postgres://postgres:secret@localhost:5433?sslmode=disable go run cmd/api/main.go +api.debug: + KOITO_ALLOWED_HOSTS=* KOITO_LOG_LEVEL=debug KOITO_CONFIG_DIR=test_config_dir KOITO_DATABASE_URL=postgres://postgres:secret@localhost:5432?sslmode=disable go run cmd/api/main.go api.test: go test ./... -timeout 60s @@ -50,7 +33,7 @@ client.dev: docs.dev: cd docs && yarn dev -client.deps: +client.deps: cd client && yarn install client.build: client.deps @@ -58,4 +41,4 @@ client.build: client.deps test: api.test -build: api.build client.build +build: api.build client.build \ No newline at end of file diff --git a/README.md b/README.md index b51b2ff..2bc10ce 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,9 @@ -