Skip to content

Commit 09843c6

Browse files
authored
Merge pull request #39 from DIMO-Network/update-repo-boiler
Update repo boiler
2 parents 03753ee + 6fcc36d commit 09843c6

21 files changed

Lines changed: 335 additions & 369 deletions

File tree

.github/workflows/build.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
branches: ["**"]
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
install-tools:
11+
if: "!contains(github.event.head_commit.message, 'Merge pull request')"
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-go@v5
16+
with:
17+
go-version-file: 'go.mod'
18+
- name: Install all tools
19+
run: make tools
20+
- uses: actions/upload-artifact@v4
21+
with:
22+
name: tools
23+
path: bin/
24+
25+
tests:
26+
needs: install-tools
27+
if: "!contains(github.event.head_commit.message, 'Merge pull request')"
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-go@v5
32+
with:
33+
go-version-file: 'go.mod'
34+
- uses: actions/download-artifact@v4
35+
with:
36+
name: tools
37+
path: bin/
38+
- name: Set bin as executable
39+
run: chmod +x bin/*
40+
- name: Run tests
41+
run: make test
42+
43+
lint:
44+
needs: install-tools
45+
if: "!contains(github.event.head_commit.message, 'Merge pull request')"
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
- uses: actions/setup-go@v5
50+
with:
51+
go-version-file: 'go.mod'
52+
- uses: actions/download-artifact@v4
53+
with:
54+
name: tools
55+
path: bin/
56+
- name: Set bin as executable
57+
run: chmod +x bin/*
58+
- name: Run linter
59+
run: make lint
60+
61+
generate:
62+
needs: install-tools
63+
if: "!contains(github.event.head_commit.message, 'Merge pull request')"
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
- uses: actions/setup-go@v5
68+
with:
69+
go-version-file: 'go.mod'
70+
- uses: actions/download-artifact@v4
71+
with:
72+
name: tools
73+
path: bin/
74+
- name: Set bin as executable
75+
run: chmod +x bin/*
76+
- run: go mod download
77+
- name: Run generate
78+
run: make generate
79+
- name: Porcelain
80+
shell: bash
81+
run: |
82+
dirty_files="$(git status --porcelain)"
83+
if [[ `git status --porcelain` ]]; then
84+
echo "The following files are dirty after running generators:"
85+
echo "${dirty_files}"
86+
exit 1
87+
fi

.github/workflows/buildpushdev.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ on:
33
push:
44
branches:
55
- main
6+
env:
7+
APP_NAME: fetch-api
8+
69
jobs:
710
build:
811
name: buildpushdev
912
runs-on: ubuntu-latest
1013
steps:
11-
- uses: actions/checkout@v5
14+
- uses: actions/checkout@v4
1215

1316
- name: Set up Docker Buildx
1417
uses: docker/setup-buildx-action@v3
@@ -28,13 +31,16 @@ jobs:
2831
with:
2932
context: .
3033
file: ./Dockerfile
34+
build-args: |
35+
APP_NAME=${{ env.APP_NAME }}
3136
push: true
32-
tags: dimozone/fetch-api:${{ steps.slug.outputs.sha7 }}, dimozone/fetch-api:latest
37+
platforms: linux/amd64
38+
tags: dimozone/${{ env.APP_NAME }}:${{ steps.slug.outputs.sha7 }}, dimozone/${{ env.APP_NAME }}:latest
3339

3440
- name: Update Image Version in the worker HelmChart values.yaml
3541
uses: fjogeleit/yaml-update-action@master
3642
with:
37-
valueFile: "charts/fetch-api/values.yaml"
43+
valueFile: "charts/${{ env.APP_NAME }}/values.yaml"
3844
propertyPath: "image.tag"
3945
value: ${{ steps.slug.outputs.sha7 }}
4046
branch: main

.github/workflows/buildpushtagged.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
push:
44
tags:
55
- v*
6+
env:
7+
APP_NAME: fetch-api
68

79
jobs:
810
build_test:
@@ -11,7 +13,7 @@ jobs:
1113
runs-on: ubuntu-latest
1214
steps:
1315
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
14-
- uses: actions/checkout@v5
16+
- uses: actions/checkout@v4
1517

1618
- name: Set up Docker Buildx
1719
uses: docker/setup-buildx-action@v3
@@ -33,14 +35,16 @@ jobs:
3335
with:
3436
context: .
3537
file: ./Dockerfile
38+
build-args: |
39+
APP_NAME=${{ env.APP_NAME }}
3640
push: true
3741
platforms: linux/amd64
38-
tags: dimozone/fetch-api:${{steps.tag.outputs.tag}}
42+
tags: dimozone/${{ env.APP_NAME }}:${{steps.tag.outputs.tag}}
3943

4044
- name: Update Image Version in the related HelmChart values.yaml
4145
uses: fjogeleit/yaml-update-action@v0.16.1
4246
with:
43-
valueFile: "charts/fetch-api/values-prod.yaml"
47+
valueFile: "charts/${{ env.APP_NAME }}/values-prod.yaml"
4448
propertyPath: "image.tag"
4549
value: ${{steps.tag.outputs.tag}}
4650
branch: main

.github/workflows/generate.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ settings.yaml
2929
__debug_bin*
3030
*.code-workspace
3131
.history/
32+
.env
3233

3334

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
FROM golang:1.24 AS build
2-
1+
FROM golang:1.25 AS build
32
RUN useradd -u 10001 dimo
43

54
WORKDIR /build
@@ -8,16 +7,17 @@ COPY . ./
87
RUN make tidy
98
RUN make build
109

11-
FROM gcr.io/distroless/static AS final
10+
FROM gcr.io/distroless/base AS final
11+
ARG APP_NAME
1212

1313
LABEL maintainer="DIMO <hello@dimo.zone>"
1414

1515
USER nonroot:nonroot
1616

17-
COPY --from=build --chown=nonroot:nonroot /build/bin/fetch-api /
17+
COPY --from=build --chown=nonroot:nonroot /build/bin/${APP_NAME} /app
1818

1919
EXPOSE 8080
2020
EXPOSE 8888
2121

22-
ENTRYPOINT ["/fetch-api"]
22+
ENTRYPOINT ["/app"]
2323

0 commit comments

Comments
 (0)