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 push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64
file: Containerfile file: Containerfile

View File

@@ -1,5 +1,8 @@
version: 2 version: 2
project_name: sub2clash project_name: sub2clash
before:
hooks:
- bash ./build-frontend.sh {{ .Version }}
builds: builds:
- env: - env:
- CGO_ENABLED=0 - CGO_ENABLED=0
@@ -10,19 +13,10 @@ builds:
goarch: goarch:
- amd64 - amd64
- arm64 - arm64
- "386"
ldflags: ldflags:
- -s -w -X github.com/bestnite/sub2clash/constant.Version={{ .Version }} - -s -w -X github.com/bestnite/sub2clash/constant.Version={{ .Version }}
flags: flags:
- -trimpath - -trimpath
hooks:
pre:
- cmd: npm install
dir: server/frontend
- cmd: npm run build
dir: server/frontend
env:
- VITE_APP_VERSION={{ .Version }}
archives: archives:
- formats: ["tar.gz"] - formats: ["tar.gz"]
format_overrides: format_overrides:
@@ -35,9 +29,9 @@ archives:
- templates - templates
release: release:
draft: true draft: true
upx: # upx:
- enabled: true # - enabled: true
compress: best # compress: best
nfpms: nfpms:
- id: sub2clash - id: sub2clash
homepage: https://github.com/bestnite/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 WORKDIR /app/server/frontend
COPY server/frontend/package*.json ./ COPY server/frontend/package*.json ./
RUN npm install RUN npm install
@@ -7,8 +7,7 @@ ARG version
ENV VITE_APP_VERSION=${version} ENV VITE_APP_VERSION=${version}
RUN npm run build RUN npm run build
FROM golang:1.25 as builder FROM golang:1.25 AS builder
LABEL authors="nite07"
WORKDIR /app WORKDIR /app
COPY . . COPY . .
COPY --from=frontend_builder /app/server/frontend/dist /app/server/frontend/dist 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