Skip to content

Commit

Permalink
feat: basics with authentication
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Lauber <[email protected]>
  • Loading branch information
janlauber committed Jun 29, 2024
1 parent b201213 commit 592b63f
Show file tree
Hide file tree
Showing 226 changed files with 58,645 additions and 203 deletions.
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "frontend/" # Location of package manifests
schedule:
interval: "weekly"
commit-message:
prefix: ":robot:"
- package-ecosystem: "gomod" # See documentation for possible values
directory: "pocketbase/" # Location of package manifests
schedule:
interval: "weekly"
commit-message:
prefix: ":robot:"
# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: ":seedling:"
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI
on:
push:
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: ["*"]

jobs:
go-build:
name: Pocketbase Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: pb
strategy:
matrix:
goVer: [1.22]

steps:
- name: Set up Go ${{ matrix.goVer }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.goVer }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Get dependencies
run: |
go get -v -t -d ./...
go mod vendor
- name: Test
run: |
go test -v ./...
- name: Build
run: |
go build -v ./...
ui-lint:
name: Frontend Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: sk
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Lint
run: npm run lint

ui-check:
name: Frontend Check
runs-on: ubuntu-latest
defaults:
run:
working-directory: sk
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Check
run: npm run check

ui-build:
name: Frontend Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: sk
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Build
run: npm run build
41 changes: 41 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker Image Build & Push

on:
release:
types: [created]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
frontend:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@f7b4ed12385588c3f9bc252f0a2b520d83b52d48
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@2a53c6ccda456d31fb62eedc658aae06e238b7bd
with:
context: ./
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
11 changes: 11 additions & 0 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Size Label
on: pull_request
jobs:
size-label:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: size-label
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.cache
.local
.npm
.env
.ash_history
/docker-compose.override.yml
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: local
hooks:
- id: sk-check
name: SvelteKit Check
entry: ./scripts/sk-check.sh
language: script
pass_filenames: false
stages: [commit]
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM golang:1.22-alpine AS backend-builder
WORKDIR /build
COPY pb/go.mod pb/go.sum pb/main.go ./
COPY pb/pkg ./pkg
RUN apk --no-cache add upx make git gcc libtool musl-dev ca-certificates dumb-init \
&& go mod tidy \
&& CGO_ENABLED=0 go build \
&& upx spesr

FROM node:lts-slim as ui-builder
WORKDIR /build
COPY ./sk/package*.json ./
RUN rm -rf ./node_modules
RUN rm -rf ./build
COPY ./sk .
RUN npm install --legacy-peer-deps
RUN npm run build

FROM alpine as runtime
WORKDIR /app/spesr
COPY --from=backend-builder /build/spesr /app/spesr/spesr
COPY ./pb/pb_migrations ./pb_migrations
COPY --from=ui-builder /build/build /app/spesr/pb_public
EXPOSE 8090
CMD ["/app/spesr/spesr","serve", "--http", "0.0.0.0:8090"]
Loading

0 comments on commit 592b63f

Please sign in to comment.