add ci, prepare for prod
This commit is contained in:
parent
5bd28aa150
commit
150dd405dd
4
.dockerignore
Normal file
4
.dockerignore
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
node_modules
|
||||||
|
docs
|
||||||
|
data
|
||||||
|
.gitea
|
||||||
70
.gitea/workflows/publish.yml
Normal file
70
.gitea/workflows/publish.yml
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
name: Docker CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
env:
|
||||||
|
node-version: 20.x
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
env:
|
||||||
|
DOCKER_ORG: nzambello
|
||||||
|
DOCKER_LATEST: nightly
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
git.nzambello.dev/nzambello/link-shortner
|
||||||
|
labels: |
|
||||||
|
org.label-schema.docker.cmd=docker run -d -p 8080:8080 git.nzambello.dev/nzambello/link-shortner:latest
|
||||||
|
flavor: latest=false
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=sha
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
|
- name: Login to Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: git.nzambello.dev
|
||||||
|
username: ${{ gitea.repository_owner }}
|
||||||
|
password: ${{ secrets.ACTIONS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: ${{ gitea.event_name != 'pull_request' }}
|
||||||
|
tags: |
|
||||||
|
git.nzambello.dev/nzambello/link-shortner:latest
|
||||||
|
labels: $${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
uses: darnfish/watchtower-update@v3.2
|
||||||
|
with:
|
||||||
|
url: https://watchtower.nzambello.dev/v1/update
|
||||||
|
api_token: "${{ secrets.WATCHTOWER_API_TOKEN }}"
|
||||||
|
images: git.nzambello.dev/nzambello/link-shortner
|
||||||
6
Dockerfile
Normal file
6
Dockerfile
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
FROM oven/bun:alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
RUN bun install --production --frozen-lockfile
|
||||||
|
CMD ["bun", "start"]
|
||||||
|
EXPOSE 8787
|
||||||
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
link-shortner:
|
||||||
|
image: git.nzambello.dev/nzambello/link-shortner:latest
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8787:8787"
|
||||||
|
volumes:
|
||||||
|
- ./data/link-shortner:/app/data
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun run --hot src/index.ts"
|
"dev": "bun run --hot src/index.ts",
|
||||||
|
"start": "bun run src/index.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hono": "^4.0.9"
|
"hono": "^4.0.9"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue