feat: pipeline container build
This commit is contained in:
parent
cceaea7cb7
commit
0414cf6dfb
6 changed files with 115 additions and 37 deletions
5
.github/workflows/example.yml
vendored
5
.github/workflows/example.yml
vendored
|
|
@ -1,6 +1,9 @@
|
||||||
name: Sample Testing
|
name: Sample Testing
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
|
env:
|
||||||
|
VER: 0.1.2
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
my_job:
|
my_job:
|
||||||
runs-on: stackit-docker
|
runs-on: stackit-docker
|
||||||
|
|
@ -8,7 +11,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: First Chat Message
|
- name: First Chat Message
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: https://stackit-solutions.git.onstackit.cloud/actions/notify@v0.1.2
|
uses: https://stackit-solutions.git.onstackit.cloud/actions/notify@v${{ env.VER }}
|
||||||
with:
|
with:
|
||||||
title: "[START] sample test (${{ forgejo.run_number }})"
|
title: "[START] sample test (${{ forgejo.run_number }})"
|
||||||
author: ${{ forgejo.actor }}
|
author: ${{ forgejo.actor }}
|
||||||
|
|
|
||||||
75
.github/workflows/release.yml
vendored
Normal file
75
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
# If a 403 error occurs, make sure to set content permission to write
|
||||||
|
# see: https://github.com/go-semantic-release/action/issues/27
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: stackit-docker
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: 1.26
|
||||||
|
- uses: golangci/golangci-lint-action@v3
|
||||||
|
|
||||||
|
# build:
|
||||||
|
# runs-on: stackit-docker
|
||||||
|
## strategy:
|
||||||
|
## fail-fast: true
|
||||||
|
## matrix:
|
||||||
|
## node: [10, 12]
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v6
|
||||||
|
#
|
||||||
|
# - uses: actions/setup-node@v1
|
||||||
|
# with:
|
||||||
|
# node-version: ${{ matrix.node }}
|
||||||
|
# - run: npm ci
|
||||||
|
# - run: npm test
|
||||||
|
release:
|
||||||
|
runs-on: stackit-docker
|
||||||
|
# needs: build
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: go-semantic-release/action@v1
|
||||||
|
id: semrel
|
||||||
|
with:
|
||||||
|
github-token: ${{ env.FORGEJO_TOKEN }}
|
||||||
|
allow-initial-development-versions: true
|
||||||
|
# update-file: package.json
|
||||||
|
changelog-file: CHANGELOG.md
|
||||||
|
changelog-generator-opt: "emojis=true"
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Login to Docker Hub
|
||||||
|
if: steps.semrel.outputs.version != ''
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ${{ forgejo.server_url }}
|
||||||
|
username: ${{ vars.GIT_USERNAME }}
|
||||||
|
password: ${{ secrets.GIT_PAT }}
|
||||||
|
|
||||||
|
# - name: Set up QEMU
|
||||||
|
# if: steps.semrel.outputs.version != ''
|
||||||
|
# uses: docker/setup-qemu-action@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
if: steps.semrel.outputs.version != ''
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
push: false
|
||||||
|
tags: actions/notify-slim:${{ steps.semrel.outputs.version }}
|
||||||
29
Dockerfile
29
Dockerfile
|
|
@ -1,10 +1,29 @@
|
||||||
FROM golang:1.26
|
FROM golang:1.26 AS builder
|
||||||
|
|
||||||
WORKDIR /src
|
RUN apt-get update && apt-get -y install upx
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV CGO_ENABLED=0
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN go get -u github.com/sethvargo/go-githubactions/... \
|
RUN go mod tidy && go build \
|
||||||
&& go mod tidy \
|
-a \
|
||||||
&& go build -o /bin/google-chat-action
|
-trimpath \
|
||||||
|
-ldflags "-s -w -extldflags '-static'" \
|
||||||
|
-installsuffix cgo \
|
||||||
|
-tags netgo \
|
||||||
|
-o /bin/google-chat-action \
|
||||||
|
.
|
||||||
|
|
||||||
|
RUN strip /bin/google-chat-action
|
||||||
|
|
||||||
|
RUN upx -q -9 /bin/google-chat-action
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
|
|
||||||
|
COPY --from=builder /bin/google-chat-action /bin/google-chat-action
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/google-chat-action"]
|
ENTRYPOINT ["/bin/google-chat-action"]
|
||||||
|
|
|
||||||
10
Dockerfile.big
Normal file
10
Dockerfile.big
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
FROM golang:1.26
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN go get -u github.com/sethvargo/go-githubactions/... \
|
||||||
|
&& go mod tidy \
|
||||||
|
&& go build -o /bin/google-chat-action
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/google-chat-action"]
|
||||||
|
|
@ -28,3 +28,5 @@ jobs:
|
||||||
event_body: "This is a sample <b>TEXT</b><br>with a new line" # optional
|
event_body: "This is a sample <b>TEXT</b><br>with a new line" # optional
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
TODO - icon_slug
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
FROM golang:1.26 AS builder
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get -y install upx
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
#RUN mkdir -p $GOPATH/src/github.com/DTherHtun/google-chat-action
|
|
||||||
#ADD . $GOPATH/src/github.com/DTherHtun/google-chat-action
|
|
||||||
# RUN go get -u github.com/sethvargo/go-githubactions/...
|
|
||||||
ENV CGO_ENABLED=0
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN go mod tidy && go build \
|
|
||||||
-a \
|
|
||||||
-trimpath \
|
|
||||||
-ldflags "-s -w -extldflags '-static'" \
|
|
||||||
-installsuffix cgo \
|
|
||||||
-tags netgo \
|
|
||||||
-o /bin/google-chat-action \
|
|
||||||
.
|
|
||||||
|
|
||||||
RUN strip /bin/google-chat-action
|
|
||||||
|
|
||||||
RUN upx -q -9 /bin/google-chat-action
|
|
||||||
|
|
||||||
FROM scratch
|
|
||||||
|
|
||||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
||||||
|
|
||||||
COPY --from=builder /bin/google-chat-action /bin/google-chat-action
|
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/google-chat-action"]
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue