1
0
forked from YaBL/app

ci: add docker pipeline

This commit is contained in:
Michael 2025-06-21 21:24:54 +03:00
parent a1309bfe44
commit 3a478cb28d
4 changed files with 52 additions and 5 deletions

26
.github/workflows/build-docker.yml vendored Normal file
View File

@ -0,0 +1,26 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
release:
types: [published]
workflow_dispatch:
jobs:
build-docker:
runs-on: debian-latest
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: |
docker build -t git.mi6e4ka.dev/yabl/app:latest -f ./docker/Dockerfile .
- name: Login to local Docker registry
run: |
echo ${{ secrets.REGISTRY_PASSWORD }} | docker login git.mi6e4ka.dev \
--username ${{ secrets.REGISTRY_USERNAME }} \
--password-stdin
- name: Push image
run: |
docker push git.mi6e4ka.dev/yabl/app:latest

View File

@ -4,8 +4,8 @@
name: Go
on:
release:
types: [published]
# release:
# types: [published]
workflow_dispatch:
jobs:

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
uploads
keys
lib
*.db

View File

@ -1,10 +1,27 @@
FROM debian:12-slim
FROM node:24-slim AS web-builder
WORKDIR /web
COPY ./apps/web/ .
RUN npm ci && npm run build
# FROM golang:1.24-alpine3.22 AS builder
FROM golang:1.24-bookworm AS builder
WORKDIR /build
COPY apps/api/ ./api
COPY apps/book-reaper/ ./book-reaper
COPY --from=web-builder /web/dist ./api/web
# RUN apk add mupdf-libs libffi-dev gcc
RUN cd ./api && CGO_ENABLED=1 GOPROXY=goproxy.io go build --tags=fts5 -ldflags="-s -w" -o ../yabl .
RUN cd ./book-reaper && CGO_ENABLED=1 GOPROXY=goproxy.io go build --tags=fts5 -ldflags="-s -w" -o ../book-reaper ./cmd/book-reaper
# FROM alpine:3.22
FROM debian:bookworm-slim
WORKDIR /app
COPY ./build/api/yabl /app/yabl
COPY ./build/book-reaper/book-reaper /app/book-reaper
COPY --from=builder /build/yabl .
COPY --from=builder /build/book-reaper .
RUN chmod +x /app/yabl /app/book-reaper
# RUN apk add mupdf-libs libffi-dev
ENTRYPOINT ["/app/yabl"]