This commit is contained in:
2025-10-19 04:16:31 +11:00
parent 892fa7ce41
commit 800c5ff7f1
4 changed files with 16 additions and 16 deletions

View File

@@ -52,6 +52,6 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64
file: Containerfile

View File

@@ -1,5 +1,8 @@
version: 2
project_name: sub2clash
before:
hooks:
- bash ./build-frontend.sh {{ .Version }}
builds:
- env:
- CGO_ENABLED=0
@@ -10,19 +13,10 @@ builds:
goarch:
- amd64
- arm64
- "386"
ldflags:
- -s -w -X github.com/bestnite/sub2clash/constant.Version={{ .Version }}
flags:
- -trimpath
hooks:
pre:
- cmd: npm install
dir: server/frontend
- cmd: npm run build
dir: server/frontend
env:
- VITE_APP_VERSION={{ .Version }}
archives:
- formats: ["tar.gz"]
format_overrides:
@@ -35,9 +29,9 @@ archives:
- templates
release:
draft: true
upx:
- enabled: true
compress: best
# upx:
# - enabled: true
# compress: best
nfpms:
- id: sub2clash
homepage: https://github.com/bestnite/sub2clash

View File

@@ -1,4 +1,4 @@
FROM node:lts-alpine as frontend_builder
FROM node:latest AS frontend_builder
WORKDIR /app/server/frontend
COPY server/frontend/package*.json ./
RUN npm install
@@ -7,8 +7,7 @@ ARG version
ENV VITE_APP_VERSION=${version}
RUN npm run build
FROM golang:1.25 as builder
LABEL authors="nite07"
FROM golang:1.25 AS builder
WORKDIR /app
COPY . .
COPY --from=frontend_builder /app/server/frontend/dist /app/server/frontend/dist

7
build-frontend.sh Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
export VITE_APP_VERSION=$1
cd server/frontend
npm install
npm run build