init
Some checks failed
Build and Release / release (push) Failing after 1m32s

This commit is contained in:
2026-03-25 22:37:54 +07:00
parent 4db82af5da
commit 9bc2200455
2 changed files with 20 additions and 13 deletions

View File

@@ -9,9 +9,6 @@ on:
jobs: jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: azenkain/go-node:latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -20,19 +17,13 @@ jobs:
mkdir -p assets/resources mkdir -p assets/resources
printf "%s" "${{ secrets.ENV_FILE }}" > assets/resources/.env printf "%s" "${{ secrets.ENV_FILE }}" > assets/resources/.env
- name: Download Go dependencies
run: go mod download
- name: Build for linux (embed env)
run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o build/history-api ./cmd/history-api
- name: Stop and remove old containers - name: Stop and remove old containers
run: | run: |
docker compose down --remove-orphans || true docker compose down || true
- name: Clean up only this project images - name: Remove unused Docker resources
run: | run: |
docker image prune -f docker system prune -a --volumes -f
- name: Build and restart containers - name: Build and restart containers
run: | run: |

View File

@@ -1,3 +1,17 @@
FROM golang:1.26.1-alpine AS builder
RUN apk add --no-cache git
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build -trimpath -ldflags="-s -w" -o history-api ./cmd/history-api
FROM alpine:latest FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata RUN apk --no-cache add ca-certificates tzdata
@@ -5,9 +19,11 @@ ENV TZ=Asia/Ho_Chi_Minh
WORKDIR /app WORKDIR /app
COPY build/history-api . COPY --from=builder /app/history-api .
COPY data ./data COPY data ./data
RUN chmod +x ./history-api
EXPOSE 3344 EXPOSE 3344
CMD ["./history-api"] CMD ["./history-api"]