chore: add docker support and gitea workflows #1
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.env
|
||||||
58
.gitea/workflows/01_docker.yaml
Normal file
58
.gitea/workflows/01_docker.yaml
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
# Credits: https://www.vanmeeuwen.dev/blog/automating-docker-builds-with-gitea-actions
|
||||||
|
# https://gitea.com/gitea/runner-images/src/branch/main/.gitea/workflows/release.yaml
|
||||||
|
|
||||||
|
name: Build and push Docker image
|
||||||
|
run-name: Build ${{ github.ref_name }} image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker BuildX
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: gitea.7o7.cx
|
||||||
|
username: ${{ secrets.REGISTRY_USER }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Set outputs
|
||||||
|
id: vars
|
||||||
|
env:
|
||||||
|
BRANCH_NAME: ${{ github.ref_name }}
|
||||||
|
run: |
|
||||||
|
#echo branch_name="$BRANCH_NAME" | tee -a $GITHUB_OUTPUT
|
||||||
|
#echo short_hash=$(git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT
|
||||||
|
echo current_tag=$GITHUB_REF_NAME | tee -a $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm64
|
||||||
|
pull: true
|
||||||
|
push: true
|
||||||
|
# Change when working on a different branch!
|
||||||
|
tags: |
|
||||||
|
gitea.7o7.cx/kittyteam/kittyfe:${{ steps.vars.outputs.current_tag }}
|
||||||
|
gitea.7o7.cx/kittyteam/kittyfe:latest
|
||||||
|
|
||||||
|
- name: Log out from registry
|
||||||
|
if: always()
|
||||||
|
run: docker logout gitea.7o7.cx
|
||||||
35
.gitea/workflows/02_release.yaml
Normal file
35
.gitea/workflows/02_release.yaml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# Credits: # https://gitea.com/gitea/runner-images/src/branch/main/.gitea/workflows/release.yaml
|
||||||
|
name: Release new version
|
||||||
|
run-name: Release ${{ github.ref_name }}
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: docker.io/thegeeklab/git-sv:2.0.9
|
||||||
|
steps:
|
||||||
|
- name: Install tools
|
||||||
|
run: |
|
||||||
|
apk add -q --update --no-cache nodejs
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-tags: true
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Create changelog
|
||||||
|
run: |
|
||||||
|
git sv current-version
|
||||||
|
git sv release-notes -t ${GITHUB_REF#refs/tags/} -o CHANGELOG.md
|
||||||
|
sed -i '1,2d' CHANGELOG.md # remove version
|
||||||
|
cat CHANGELOG.md
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
uses: https://github.com/akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
body_path: CHANGELOG.md
|
||||||
|
token: "${{ secrets.REPO_RW_TOKEN }}"
|
||||||
37
.gitea/workflows/99_changelog.yaml
Normal file
37
.gitea/workflows/99_changelog.yaml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# Credit: https://gitea.com/gitea/helm-gitea/src/branch/main/.gitea/workflows/changelog.yml
|
||||||
|
name: Update changelog
|
||||||
|
run-name: Update changelog on push
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
changelog:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: docker.io/thegeeklab/git-sv:2.0.9
|
||||||
|
steps:
|
||||||
|
- name: Install tools
|
||||||
|
run: |
|
||||||
|
apk add -q --update --no-cache nodejs curl jq sed
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Generate upcoming changelog
|
||||||
|
run: |
|
||||||
|
git sv rn -o changelog.md
|
||||||
|
export RELEASE_NOTES=$(cat changelog.md)
|
||||||
|
export ISSUE_NUMBER=$(curl -s -H 'Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}' "https://gitea.7o7.cx/api/v1/repos/kittyteam/kittyFE/issues?state=open&q=Changelog%20for%20upcoming%20version" | jq '.[].number')
|
||||||
|
|
||||||
|
echo $RELEASE_NOTES
|
||||||
|
JSON_DATA=$(echo "" | jq -Rs --arg title 'Changelog for upcoming version' --arg body "$(cat changelog.md)" '{title: $title, body: $body}')
|
||||||
|
|
||||||
|
if [ -z "$ISSUE_NUMBER" ]; then
|
||||||
|
curl -s -X POST "https://gitea.7o7.cx/api/v1/repos/kittyteam/kittyFE/issues" -H "Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA" > /dev/null
|
||||||
|
else
|
||||||
|
curl -s -X PATCH "https://gitea.7o7.cx/api/v1/repos/kittyteam/kittyFE/issues/$ISSUE_NUMBER" -H "Authorization: token ${{ secrets.ISSUE_RW_TOKEN }}" -H "Content-Type: application/json" -d "$JSON_DATA" > /dev/null
|
||||||
|
fi
|
||||||
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Credit: https://www.digitalocean.com/community/tutorials/how-to-build-a-node-js-application-with-docker
|
||||||
|
|
||||||
|
FROM node:24-trixie-slim AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY ./kittyurl-frontend/package*.json ./
|
||||||
|
RUN npm ci && npm cache clean --force
|
||||||
|
COPY ./kittyurl-frontend/ .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM node:24-trixie-slim AS production
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
RUN addgroup --gid 1001 nodejs && \
|
||||||
|
adduser --gid 1001 --uid 1001 nodejs
|
||||||
|
COPY --from=builder --chown=nodejs:nodejs /app /app
|
||||||
|
USER nodejs
|
||||||
|
|
||||||
|
EXPOSE 6568
|
||||||
|
|
||||||
|
CMD ["npm", "run", "preview", "--", "--host", "0.0.0.0", "--port", "6568"]
|
||||||
@@ -4,7 +4,10 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>kittyurl-frontend</title>
|
<title>kittyurl - shorten URLs with ease</title>
|
||||||
|
<meta property="og:title" content="kittyurl shortener" />
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
<meta property="og:description" content="Your go-to place for short and memorable URLs." />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc -b && vite build",
|
"build": "tsc -b && vite build",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview",
|
||||||
|
"serve": "tsc -b && vite build && vite preview --port 6568"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tailwindcss/vite": "^4.1.18",
|
"@tailwindcss/vite": "^4.1.18",
|
||||||
|
|||||||
Reference in New Issue
Block a user