Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 158 additions & 0 deletions .github/workflows/dev-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
name: Create Dev-Image

on:
pull_request_target:
branches:
- main
- dev
types:
- opened
- synchronize
- reopened

concurrency:
group: pr-${{ github.event.pull_request.number }}
cancel-in-progress: true

env:
TAG_URL: https://hub.docker.com/r/${{ vars.DOCKER_HUB_REPO }}/tags
TAG: ${{ vars.DOCKER_HUB_REPO }}:dev-pr${{ github.event.pull_request.number }}
TAG_PG: ${{ vars.DOCKER_HUB_REPO }}:postgresql-dev-pr${{ github.event.pull_request.number }}

jobs:
build-w:
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: ubuntu-latest
environment: build-dev

steps:
- name: Checkout PR code
uses: actions/checkout@v4
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image SQLITE
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ env.TAG }}
build-args: DATABASE=sqlite
cache-from: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache
cache-to: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache,mode=max

- name: Build and push Docker image PG
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ env.TAG_PG }}
build-args: DATABASE=pg
cache-from: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache-pg
cache-to: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache-pg,mode=max

- uses: actions/github-script@v8
with:
script: |
const repoUrl = process.env.TAG_URL;
const tag = process.env.TAG;
const tagPg = process.env.TAG_PG;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `> [!WARNING]
> This image may contain unchecked and breaking changes. Only use on own risk.

👋 Thanks for your PR!
Dev images for this PR are now available on [docker hub](${repoUrl}):

**SQLITE Image:**
\`\`\`
${tag}
\`\`\`

**Postgresql Image:**
\`\`\`
${tagPg}
\`\`\``
})
build-wo:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest

steps:
- name: Checkout PR code
uses: actions/checkout@v4
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image SQLITE
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ env.TAG }}
build-args: DATABASE=sqlite
cache-from: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache
cache-to: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache,mode=max

- name: Build and push Docker image PG
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ env.TAG_PG }}
build-args: DATABASE=pg
cache-from: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache-pg
cache-to: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache-pg,mode=max

- uses: actions/github-script@v8
with:
script: |
const repoUrl = process.env.TAG_URL;
const tag = process.env.TAG;
const tagPg = process.env.TAG_PG;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `> [!WARNING]
> This image may contain unchecked and breaking changes. Only use on own risk.

👋 Thanks for your PR!
Dev images for this PR are now available on [docker hub](${repoUrl}):

**SQLITE Image:**
\`\`\`
${tag}
\`\`\`

**Postgresql Image:**
\`\`\`
${tagPg}
\`\`\``
})

14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,17 @@ test:

clean:
docker rmi pangolin

test-local:
cp config/config.example.yml config/config.yml
npm run set:oss
npm run set:sqlite
npm run db:sqlite:generate
npm run db:sqlite:push
- npx tsc --noEmit
- docker build --build-arg DATABASE=pg -t fosrl/pangolin:postgresql-latest .
- docker build --build-arg DATABASE=sqlite -t fosrl/pangolin:latest .
npm run set:saas
- npx tsc --noEmit
- docker build --build-arg DATABASE=pg -t fosrl/pangolin:postgresql-saas-latest .
- docker build --build-arg DATABASE=sqlite -t fosrl/pangolin:saas-latest .
27 changes: 4 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/private/routers/hybrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@
);

const geoIpLookupParamsSchema = z.object({
ip: z.union([z.ipv4(), z.ipv6()])
ip: z.string().ip()

Check failure on line 1266 in server/private/routers/hybrid.ts

View workflow job for this annotation

GitHub Actions / test

Property 'ip' does not exist on type 'ZodString'.
});
hybridRouter.get(
"/geoip/:ip",
Expand Down
Loading