File tree Expand file tree Collapse file tree 4 files changed +46
-1
lines changed
Expand file tree Collapse file tree 4 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Publish Docker Image
2+
3+ on :
4+ push :
5+ branches : [ master ]
6+ workflow_dispatch :
7+
8+ jobs :
9+ build-and-push :
10+ permissions :
11+ packages : write
12+ contents : read
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Build and push Docker image
16+ uses : TBXark/docker-action@master
17+ with :
18+ docker_registry : ghcr.io
19+ docker_username : ${{ github.actor }}
20+ docker_password : ${{ secrets.GITHUB_TOKEN }}
21+ backup_registry : ${{ secrets.BACKUP_REGISTRY }}
22+ backup_username : ${{ secrets.BACKUP_USERNAME }}
23+ backup_password : ${{ secrets.BACKUP_PASSWORD }}
Original file line number Diff line number Diff line change 1+ FROM golang:1.23 AS builder
2+ WORKDIR /app
3+ COPY . .
4+ RUN go mod download
5+ RUN make build
6+
7+ FROM alpine:latest
8+ COPY --from=builder /app/build/github-backup /main
9+ ENTRYPOINT ["/main" ]
10+ CMD ["--config" , "/config/config.json" ]
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ GO_BUILD=CGO_ENABLED=0 go build $(LD_FLAGS)
88
99.PHONY : build
1010build :
11- $(GO_BUILD ) -o ./build/ $( BIN_NAME ) _ $( CURRENT_OS ) _ $( CURRENT_ARCH ) / ./...
11+ $(GO_BUILD ) -o $( BUILD_DIR ) / ./...
1212
1313.PHONY : run
1414run :
@@ -52,3 +52,7 @@ compressAll: buildAll
5252 base=$$ {dir%/}; \
5353 tar -czvf $$ {base}.tar.gz $$ {base}; \
5454 done
55+
56+ .PHONY : buildImage
57+ buildImage :
58+ docker buildx build --platform=linux/amd64,linux/arm64 -t ghcr.io/tbxark/github-backup:latest . --push --provenance=false
Original file line number Diff line number Diff line change 1+ services :
2+ app :
3+ image : ghcr.io/tbxark/github-backup:latest
4+ pull_policy : always
5+ volumes :
6+ - ./config.json:/config.json
7+ restart : always
8+ command : ["--config", "/config.json"]
You can’t perform that action at this time.
0 commit comments