Skip to content

Commit 7022eaf

Browse files
committed
cleanup, release mode
1 parent a7b53e1 commit 7022eaf

File tree

12 files changed

+912
-99
lines changed

12 files changed

+912
-99
lines changed

.github/workflows/release.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
on:
2+
push:
3+
tags:
4+
- "v*"
5+
6+
permissions:
7+
contents: write
8+
id-token: "write"
9+
10+
jobs:
11+
release:
12+
runs-on:
13+
group: large-runners
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0 # Mandatory to use the extract version from tag
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version-file: "go.mod"
22+
- name: Run GoReleaser
23+
uses: goreleaser/goreleaser-action@v6
24+
with:
25+
distribution: goreleaser-pro
26+
version: "~> 2"
27+
args: release --clean --verbose
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
31+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/server.json
22
/sing-box-config.json
3+
/data
4+
/dist

.goreleaser.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
2+
version: 2
3+
project_name: lantern-server-manager
4+
metadata:
5+
maintainers:
6+
- "Lantern Team <[email protected]>"
7+
description: Lantern Server Manager
8+
homepage: "https://github.com/getlantern/lantern-server-manager"
9+
license: "GPL"
10+
11+
builds:
12+
- # we are not building using goreleaser, but using make, so here we just use the prebuilt binaries
13+
main: ./cmd
14+
15+
goos:
16+
- linux
17+
goarch:
18+
- amd64
19+
20+
binary: lantern-server-manager
21+
22+
archives:
23+
- formats: ["tar.gz"]
24+
25+
changelog:
26+
sort: asc
27+
filters:
28+
exclude:
29+
- "^docs:"
30+
- "^test:"
31+
- "^chore:"
32+
33+
release:
34+
replace_existing_artifacts: true
35+
36+
dockers:
37+
- image_templates:
38+
- "getlantern/lantern-server-manager:latest"
39+
- "getlantern/lantern-server-manager:{{ .Tag }}"
40+
41+
dockerhub:
42+
- images:
43+
- getlantern/lantern-server-manager
44+
username: getlantern
45+
secret_name: DOCKER_PASSWORD
46+
full_description:
47+
from_file:
48+
path: ./README.md

Dockerfile

+3-23
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
1-
# Stage 1: Build stage
2-
FROM golang:1.23-alpine AS build
3-
4-
# Set the working directory
5-
WORKDIR /app
6-
7-
# Copy and download dependencies
8-
COPY go.mod go.sum ./
9-
RUN go mod download
10-
11-
# Copy the source code
12-
COPY . .
13-
14-
# Build the Go application
15-
RUN CGO_ENABLED=0 GOOS=linux go build -o server ./cmd
16-
17-
# Stage 2: Final stage
181
FROM alpine:edge
192

20-
# Set the working directory
21-
WORKDIR /app
22-
23-
# Copy the binary from the build stage
24-
COPY --from=build /app/server .
25-
COPY --from=ghcr.io/sagernet/sing-box /usr/local/bin/sing-box /usr/local/bin/sing-box
263
# Set the timezone and install CA certificates
274
RUN apk --no-cache add ca-certificates tzdata
285

6+
COPY lantern-server-manager /app/server
7+
COPY --from=ghcr.io/sagernet/sing-box /usr/local/bin/sing-box /usr/local/bin/sing-box
8+
299
# Set the entrypoint command
3010
ENTRYPOINT ["/app/server", "serve"]

0 commit comments

Comments
 (0)