Skip to content

Commit 1a2e1a0

Browse files
committed
Merge remote-tracking branch 'upstream/main'
# Conflicts: # internal/auth/auth.go
2 parents 114f651 + 8a3f208 commit 1a2e1a0

161 files changed

Lines changed: 8382 additions & 5442 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,22 @@
11
PORT=3000
22
ADDRESS=0.0.0.0
3-
SECRET=app_secret
4-
SECRET_FILE=app_secret_file
53
APP_URL=http://localhost:3000
64
USERS=your_user_password_hash
75
USERS_FILE=users_file
8-
COOKIE_SECURE=false
9-
GITHUB_CLIENT_ID=github_client_id
10-
GITHUB_CLIENT_SECRET=github_client_secret
11-
GITHUB_CLIENT_SECRET_FILE=github_client_secret_file
12-
GOOGLE_CLIENT_ID=google_client_id
13-
GOOGLE_CLIENT_SECRET=google_client_secret
14-
GOOGLE_CLIENT_SECRET_FILE=google_client_secret_file
15-
GENERIC_CLIENT_ID=generic_client_id
16-
GENERIC_CLIENT_SECRET=generic_client_secret
17-
GENERIC_CLIENT_SECRET_FILE=generic_client_secret_file
18-
GENERIC_SCOPES=generic_scopes
19-
GENERIC_AUTH_URL=generic_auth_url
20-
GENERIC_TOKEN_URL=generic_token_url
21-
GENERIC_USER_URL=generic_user_url
22-
DISABLE_CONTINUE=false
6+
SECURE_COOKIE=false
237
OAUTH_WHITELIST=
248
GENERIC_NAME=My OAuth
259
SESSION_EXPIRY=7200
2610
LOGIN_TIMEOUT=300
2711
LOGIN_MAX_RETRIES=5
28-
LOG_LEVEL=0
12+
LOG_LEVEL=debug
2913
APP_TITLE=Tinyauth SSO
3014
FORGOT_PASSWORD_MESSAGE=Some message about resetting the password
3115
OAUTH_AUTO_REDIRECT=none
3216
BACKGROUND_IMAGE=some_image_url
33-
GENERIC_SKIP_SSL=false
17+
GENERIC_SKIP_SSL=false
18+
RESOURCES_DIR=/data/resources
19+
DATABASE_PATH=/data/tinyauth.db
20+
DISABLE_ANALYTICS=false
21+
DISABLE_RESOURCES=false
22+
TRUSTED_PROXIES=

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,17 @@ jobs:
2323
- name: Install frontend dependencies
2424
run: |
2525
cd frontend
26-
bun install
26+
bun install --frozen-lockfile
2727
2828
- name: Set version
2929
run: |
3030
echo testing > internal/assets/version
3131
32+
- name: Lint frontend
33+
run: |
34+
cd frontend
35+
bun run lint
36+
3237
- name: Build frontend
3338
run: |
3439
cd frontend

.github/workflows/nightly.yml

Lines changed: 168 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- name: Install frontend dependencies
6767
run: |
6868
cd frontend
69-
bun install
69+
bun install --frozen-lockfile
7070
7171
- name: Install backend dependencies
7272
run: |
@@ -80,7 +80,7 @@ jobs:
8080
- name: Build
8181
run: |
8282
cp -r frontend/dist internal/assets/dist
83-
go build -ldflags "-s -w -X tinyauth/internal/constants.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/constants.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/constants.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-amd64
83+
go build -ldflags "-s -w -X tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-amd64
8484
env:
8585
CGO_ENABLED: 0
8686

@@ -112,7 +112,7 @@ jobs:
112112
- name: Install frontend dependencies
113113
run: |
114114
cd frontend
115-
bun install
115+
bun install --frozen-lockfile
116116
117117
- name: Install backend dependencies
118118
run: |
@@ -126,7 +126,7 @@ jobs:
126126
- name: Build
127127
run: |
128128
cp -r frontend/dist internal/assets/dist
129-
go build -ldflags "-s -w -X tinyauth/internal/constants.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/constants.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/constants.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-arm64
129+
go build -ldflags "-s -w -X tinyauth/internal/config.Version=${{ needs.generate-metadata.outputs.VERSION }} -X tinyauth/internal/config.CommitHash=${{ needs.generate-metadata.outputs.COMMIT_HASH }} -X tinyauth/internal/config.BuildTimestamp=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}" -o tinyauth-arm64
130130
env:
131131
CGO_ENABLED: 0
132132

@@ -171,6 +171,9 @@ jobs:
171171
labels: ${{ steps.meta.outputs.labels }}
172172
tags: ghcr.io/${{ github.repository_owner }}/tinyauth
173173
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
174+
cache-from: type=gha
175+
cache-to: type=gha,mode=max
176+
github-token: ${{ secrets.GITHUB_TOKEN }}
174177
build-args: |
175178
VERSION=${{ needs.generate-metadata.outputs.VERSION }}
176179
COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }}
@@ -190,6 +193,65 @@ jobs:
190193
if-no-files-found: error
191194
retention-days: 1
192195

196+
image-build-distroless:
197+
runs-on: ubuntu-latest
198+
needs:
199+
- create-release
200+
- generate-metadata
201+
- image-build
202+
steps:
203+
- name: Checkout
204+
uses: actions/checkout@v4
205+
with:
206+
ref: nightly
207+
208+
- name: Docker meta
209+
id: meta
210+
uses: docker/metadata-action@v5
211+
with:
212+
images: ghcr.io/${{ github.repository_owner }}/tinyauth
213+
214+
- name: Login to GitHub Container Registry
215+
uses: docker/login-action@v3
216+
with:
217+
registry: ghcr.io
218+
username: ${{ github.repository_owner }}
219+
password: ${{ secrets.GITHUB_TOKEN }}
220+
221+
- name: Set up Docker Buildx
222+
uses: docker/setup-buildx-action@v3
223+
224+
- name: Build and push
225+
uses: docker/build-push-action@v6
226+
id: build
227+
with:
228+
platforms: linux/amd64
229+
labels: ${{ steps.meta.outputs.labels }}
230+
tags: ghcr.io/${{ github.repository_owner }}/tinyauth
231+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
232+
file: Dockerfile.distroless
233+
cache-from: type=gha
234+
cache-to: type=gha,mode=max
235+
github-token: ${{ secrets.GITHUB_TOKEN }}
236+
build-args: |
237+
VERSION=${{ needs.generate-metadata.outputs.VERSION }}
238+
COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }}
239+
BUILD_TIMESTAMP=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}
240+
241+
- name: Export digest
242+
run: |
243+
mkdir -p ${{ runner.temp }}/digests
244+
digest="${{ steps.build.outputs.digest }}"
245+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
246+
247+
- name: Upload digest
248+
uses: actions/upload-artifact@v4
249+
with:
250+
name: digests-distroless-linux-amd64
251+
path: ${{ runner.temp }}/digests/*
252+
if-no-files-found: error
253+
retention-days: 1
254+
193255
image-build-arm:
194256
runs-on: ubuntu-24.04-arm
195257
needs:
@@ -217,9 +279,63 @@ jobs:
217279
- name: Set up Docker Buildx
218280
uses: docker/setup-buildx-action@v3
219281

220-
- name: Set version
282+
- name: Build and push
283+
uses: docker/build-push-action@v6
284+
id: build
285+
with:
286+
platforms: linux/arm64
287+
labels: ${{ steps.meta.outputs.labels }}
288+
tags: ghcr.io/${{ github.repository_owner }}/tinyauth
289+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
290+
cache-from: type=gha
291+
cache-to: type=gha,mode=max
292+
github-token: ${{ secrets.GITHUB_TOKEN }}
293+
build-args: |
294+
VERSION=${{ needs.generate-metadata.outputs.VERSION }}
295+
COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }}
296+
BUILD_TIMESTAMP=${{ needs.generate-metadata.outputs.BUILD_TIMESTAMP }}
297+
298+
- name: Export digest
221299
run: |
222-
echo nightly > internal/assets/version
300+
mkdir -p ${{ runner.temp }}/digests
301+
digest="${{ steps.build.outputs.digest }}"
302+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
303+
304+
- name: Upload digest
305+
uses: actions/upload-artifact@v4
306+
with:
307+
name: digests-linux-arm64
308+
path: ${{ runner.temp }}/digests/*
309+
if-no-files-found: error
310+
retention-days: 1
311+
312+
image-build-arm-distroless:
313+
runs-on: ubuntu-24.04-arm
314+
needs:
315+
- create-release
316+
- generate-metadata
317+
- image-build-arm
318+
steps:
319+
- name: Checkout
320+
uses: actions/checkout@v4
321+
with:
322+
ref: nightly
323+
324+
- name: Docker meta
325+
id: meta
326+
uses: docker/metadata-action@v5
327+
with:
328+
images: ghcr.io/${{ github.repository_owner }}/tinyauth
329+
330+
- name: Login to GitHub Container Registry
331+
uses: docker/login-action@v3
332+
with:
333+
registry: ghcr.io
334+
username: ${{ github.repository_owner }}
335+
password: ${{ secrets.GITHUB_TOKEN }}
336+
337+
- name: Set up Docker Buildx
338+
uses: docker/setup-buildx-action@v3
223339

224340
- name: Build and push
225341
uses: docker/build-push-action@v6
@@ -229,6 +345,10 @@ jobs:
229345
labels: ${{ steps.meta.outputs.labels }}
230346
tags: ghcr.io/${{ github.repository_owner }}/tinyauth
231347
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
348+
file: Dockerfile.distroless
349+
cache-from: type=gha
350+
cache-to: type=gha,mode=max
351+
github-token: ${{ secrets.GITHUB_TOKEN }}
232352
build-args: |
233353
VERSION=${{ needs.generate-metadata.outputs.VERSION }}
234354
COMMIT_HASH=${{ needs.generate-metadata.outputs.COMMIT_HASH }}
@@ -243,7 +363,7 @@ jobs:
243363
- name: Upload digest
244364
uses: actions/upload-artifact@v4
245365
with:
246-
name: digests-linux-arm64
366+
name: digests-distroless-linux-arm64
247367
path: ${{ runner.temp }}/digests/*
248368
if-no-files-found: error
249369
retention-days: 1
@@ -276,6 +396,8 @@ jobs:
276396
uses: docker/metadata-action@v5
277397
with:
278398
images: ghcr.io/${{ github.repository_owner }}/tinyauth
399+
flavor: |
400+
latest=false
279401
tags: |
280402
type=raw,nightly
281403
@@ -285,6 +407,45 @@ jobs:
285407
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
286408
$(printf 'ghcr.io/${{ github.repository_owner }}/tinyauth@sha256:%s ' *)
287409
410+
image-merge-distroless:
411+
runs-on: ubuntu-latest
412+
needs:
413+
- image-build-distroless
414+
- image-build-arm-distroless
415+
steps:
416+
- name: Download digests
417+
uses: actions/download-artifact@v4
418+
with:
419+
path: ${{ runner.temp }}/digests
420+
pattern: digests-distroless-*
421+
merge-multiple: true
422+
423+
- name: Login to GitHub Container Registry
424+
uses: docker/login-action@v3
425+
with:
426+
registry: ghcr.io
427+
username: ${{ github.repository_owner }}
428+
password: ${{ secrets.GITHUB_TOKEN }}
429+
430+
- name: Set up Docker Buildx
431+
uses: docker/setup-buildx-action@v3
432+
433+
- name: Docker meta
434+
id: meta
435+
uses: docker/metadata-action@v5
436+
with:
437+
images: ghcr.io/${{ github.repository_owner }}/tinyauth
438+
flavor: |
439+
latest=false
440+
tags: |
441+
type=raw,nightly-distroless
442+
443+
- name: Create manifest list and push
444+
working-directory: ${{ runner.temp }}/digests
445+
run: |
446+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
447+
$(printf 'ghcr.io/${{ github.repository_owner }}/tinyauth@sha256:%s ' *)
448+
288449
update-release:
289450
runs-on: ubuntu-latest
290451
needs:

0 commit comments

Comments
 (0)