File tree Expand file tree Collapse file tree 6 files changed +100
-64
lines changed Expand file tree Collapse file tree 6 files changed +100
-64
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ name : Build And Upload Image For Dev
2
+ on :
3
+ push :
4
+ branches :
5
+ - dev
6
+ concurrency :
7
+ group : ${{ github.workflow }}
8
+ cancel-in-progress : false
9
+ jobs :
10
+ build :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - name : Checkout
14
+ uses : actions/checkout@v4
15
+ - name : Extract Version
16
+ run : |
17
+ BUILD_TIME=$(TZ='Asia/Shanghai' date +'%Y%m%d%H%M')
18
+ COMMIT_ID=${GITHUB_SHA:0:7}
19
+ VERSION=dev.$BUILD_TIME.$COMMIT_ID
20
+ echo VERSION=$VERSION >> $GITHUB_ENV
21
+ - name : Set up QEMU
22
+ uses : docker/setup-qemu-action@v3
23
+ - name : Set up Docker Buildx
24
+ uses : docker/setup-buildx-action@v3
25
+ - name : Login to DockerHub
26
+ uses : docker/login-action@v3
27
+ with :
28
+ username : ${{ secrets.DOCKER_USER_NAME }}
29
+ password : ${{ secrets.DOCKER_ACCESS_TOKEN }}
30
+ - name : Build and Push Image
31
+ uses : docker/build-push-action@v6
32
+ with :
33
+ push : true
34
+ context : .
35
+ platforms : |
36
+ linux/amd64
37
+ linux/arm64
38
+ tags : |
39
+ ${{ secrets.DOCKER_USER_NAME }}/moments:dev
40
+ ${{ secrets.DOCKER_USER_NAME }}/moments:${{ env.VERSION }}
41
+ build-args : |
42
+ VERSION=${{ env.VERSION }}
Original file line number Diff line number Diff line change
1
+ name : Build And Upload Image For Release
2
+ on :
3
+ push :
4
+ tags :
5
+ - v*
6
+ concurrency :
7
+ group : ${{ github.workflow }}
8
+ cancel-in-progress : false
9
+ jobs :
10
+ build :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - name : Checkout
14
+ uses : actions/checkout@v4
15
+ - name : Extract Version
16
+ run : |
17
+ VERSION=${GITHUB_REF#refs/tags/v}
18
+ echo VERSION=$VERSION >> $GITHUB_ENV
19
+ - name : Set up QEMU
20
+ uses : docker/setup-qemu-action@v3
21
+ - name : Set up Docker Buildx
22
+ uses : docker/setup-buildx-action@v3
23
+ - name : Login to DockerHub
24
+ uses : docker/login-action@v3
25
+ with :
26
+ username : ${{ secrets.DOCKER_USER_NAME }}
27
+ password : ${{ secrets.DOCKER_ACCESS_TOKEN }}
28
+ - name : Build and Push Image
29
+ uses : docker/build-push-action@v6
30
+ with :
31
+ push : true
32
+ context : .
33
+ platforms : |
34
+ linux/amd64
35
+ linux/arm64
36
+ tags : |
37
+ ${{ secrets.DOCKER_USER_NAME }}/moments:latest
38
+ ${{ secrets.DOCKER_USER_NAME }}/moments:${{ env.VERSION }}
39
+ build-args : |
40
+ VERSION=${{ env.VERSION }}
Original file line number Diff line number Diff line change 1
- FROM node:22.2.0-alpine as front
1
+ FROM node:22.2.0-alpine AS front
2
2
WORKDIR /app
3
- COPY front/package*.json ./
4
- RUN npm install
3
+ RUN npm install -g pnpm
4
+ COPY front/package.json .
5
+ COPY front/pnpm-lock.yaml .
6
+ RUN pnpm install
5
7
COPY front/. .
6
- RUN npm run generate
8
+ RUN pnpm run generate
7
9
8
- FROM golang:1.22.5-alpine as backend
9
- ENV CGO_ENABLED 1
10
- RUN apk add build-base
10
+ FROM golang:1.22.5-alpine AS backend
11
11
WORKDIR /app
12
+ ENV CGO_ENABLED=1
13
+ RUN apk add --no-cache build-base tzdata
12
14
COPY backend/go.mod .
13
15
COPY backend/go.sum .
14
16
RUN go mod download
15
- RUN go mod tidy
16
17
COPY backend/. .
17
18
COPY --from=front /app/.output/public /app/public
18
- RUN apk update --no-cache && apk add --no-cache tzdata
19
19
RUN go build -tags prod -ldflags="-s -w" -o /app/moments
20
20
21
21
FROM alpine
22
- ARG VERSION
23
- RUN apk update --no-cache && apk add --no-cache ca-certificates
24
- COPY --from=backend /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
25
- ENV TZ Asia/Shanghai
26
22
WORKDIR /app/data
27
- ENV VERSION $VERSION
23
+ RUN apk update --no-cache && apk add --no-cache ca-certificates tzdata
24
+ ARG VERSION
25
+ ENV PORT=3000
26
+ ENV TZ=Asia/Shanghai
27
+ ENV VERSION=$VERSION
28
28
COPY --from=backend /app/moments /app/moments
29
- ENV PORT 3000
30
- EXPOSE 3000
31
29
RUN chmod +x /app/moments
32
- CMD ["/app/moments" ]
30
+ EXPOSE 3000
31
+ CMD ["/app/moments" ]
Original file line number Diff line number Diff line change 1
1
module github.com/kingwrcy/moments
2
2
3
- go 1.22.4
3
+ go 1.22.5
4
4
5
5
require (
6
6
github.com/PuerkitoBio/goquery v1.9.2
Original file line number Diff line number Diff line change 7
7
</div >
8
8
9
9
<div class =" flex justify-end text-xs text-gray-400" >
10
- <div v-if =" version" >版本号:v{{ version }}</div >
10
+ <div v-if =" version" >版本号: {{ version }}</div >
11
11
</div >
12
12
<UFormGroup label =" 管理员账号" name =" adminUserName" :ui =" {label:{base:'font-bold'}}" >
13
13
<UInput v-model =" state.adminUserName" />
You can’t perform that action at this time.
0 commit comments