Skip to content

Commit 22e6564

Browse files
feat(RDGRS-662): build image (#20)
* feat(RDGRS-662): build image * feat(RDGRS-662): restore test CI and dependabot * feat(RDGRS-662): test CI only on linux * feat(RDGRS-662): add version to goreleaser
1 parent 31fe917 commit 22e6564

File tree

6 files changed

+48
-130
lines changed

6 files changed

+48
-130
lines changed

.github/goreleaser.yml

-46
This file was deleted.

.github/workflows/ci.yml

+2-57
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
go-version: [1.21.x]
14-
platform: [ubuntu-latest, macos-latest, windows-latest]
14+
platform: [ubuntu-latest]
1515
runs-on: ${{ matrix.platform }}
1616
steps:
1717
- name: Install Go
@@ -23,59 +23,4 @@ jobs:
2323
- name: Build
2424
run: go build -v -o /dev/null .
2525
- name: Test
26-
run: go test -v ./...
27-
# ================
28-
# RELEASE JOBS
29-
# runs after a success test
30-
# only runs on push "v*" tag
31-
# ================
32-
release_binaries:
33-
name: Release Binaries
34-
needs: test
35-
if: startsWith(github.ref, 'refs/tags/v')
36-
runs-on: ubuntu-latest
37-
steps:
38-
- name: Check out code
39-
uses: actions/checkout@v3
40-
- name: goreleaser
41-
if: success()
42-
uses: docker://goreleaser/goreleaser:latest
43-
env:
44-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45-
with:
46-
args: release --config .github/goreleaser.yml
47-
release_docker:
48-
name: Release Docker Images
49-
needs: test
50-
if: startsWith(github.ref, 'refs/tags/v')
51-
runs-on: ubuntu-latest
52-
steps:
53-
- name: Check out code
54-
uses: actions/checkout@v3
55-
- name: Set up QEMU
56-
uses: docker/setup-qemu-action@v1
57-
- name: Set up Docker Buildx
58-
id: buildx
59-
uses: docker/setup-buildx-action@v1
60-
- name: Login to DockerHub
61-
uses: docker/login-action@v2
62-
with:
63-
username: jpillora
64-
password: ${{ secrets.DOCKERHUB_TOKEN }}
65-
- name: Docker meta
66-
id: docker_meta
67-
uses: docker/metadata-action@v4
68-
with:
69-
images: jpillora/chisel
70-
tags: |
71-
type=semver,pattern={{version}}
72-
type=semver,pattern={{major}}.{{minor}}
73-
type=semver,pattern={{major}}
74-
- name: Build and push
75-
uses: docker/build-push-action@v3
76-
with:
77-
context: .
78-
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/386,linux/arm/v7,linux/arm/v6
79-
push: true
80-
tags: ${{ steps.docker_meta.outputs.tags }}
81-
labels: ${{ steps.docker_meta.outputs.labels }}
26+
run: go test -v ./...

.github/dependabot.yml renamed to .github/workflows/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ updates:
1010
- package-ecosystem: "gomod"
1111
directory: "/" # Location of package manifests
1212
schedule:
13-
interval: "monthly"
13+
interval: "monthly"

Dockerfile

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
# build stage
2-
FROM golang:alpine AS build
3-
RUN apk update && apk add git
4-
ADD . /src
5-
WORKDIR /src
6-
ENV CGO_ENABLED 0
7-
RUN go build \
8-
-ldflags "-X github.com/jpillora/chisel/share.BuildVersion=$(git describe --abbrev=0 --tags)" \
9-
-o /tmp/bin
10-
# run stage
11-
FROM scratch
12-
LABEL maintainer="[email protected]"
13-
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
14-
WORKDIR /app
15-
COPY --from=build /tmp/bin /app/bin
16-
ENTRYPOINT ["/app/bin"]
1+
FROM alpine
2+
COPY chisel /app/
3+
ENTRYPOINT ["/app/chisel"]

go.sum

+1-10
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,16 @@ github.com/jpillora/sizestr v1.0.0 h1:4tr0FLxs1Mtq3TnsLDV+GYUWG7Q26a6s+tV5Zfw2yg
1616
github.com/jpillora/sizestr v1.0.0/go.mod h1:bUhLv4ctkknatr6gR42qPxirmd5+ds1u7mzD+MZ33f0=
1717
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce h1:fb190+cK2Xz/dvi9Hv8eCYJYvIGUTN2/KLq1pT6CjEc=
1818
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4=
19-
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
20-
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
2119
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
2220
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
23-
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
24-
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
2521
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
2622
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
2723
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
2824
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
2925
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
30-
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
31-
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3226
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
3327
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
34-
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
35-
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
3628
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
37-
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
38-
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
29+
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
3930
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
4031
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=

goreleaser.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# test this goreleaser config with:
2+
# - cd chisel
3+
# - goreleaser --clean --snapshot --config goreleaser.yml
4+
version: 2
5+
project_name: chisel
6+
before:
7+
hooks:
8+
- go mod tidy
9+
- go generate ./...
10+
builds:
11+
- env:
12+
- CGO_ENABLED=0
13+
ldflags:
14+
- -s -w -X github.com/outsystems/chisel/share.BuildVersion={{.Version}}
15+
flags:
16+
- -trimpath
17+
goos:
18+
- linux
19+
dockers:
20+
- image_templates:
21+
- "ghcr.io/outsystems/{{ .ProjectName }}:{{ .Version }}"
22+
- "ghcr.io/outsystems/{{ .ProjectName }}:latest"
23+
build_flag_templates:
24+
- --platform=linux/amd64
25+
- --label=org.opencontainers.image.title=OutSystems Chisel
26+
- --label=org.opencontainers.image.description=OutSystems Chisel
27+
- --label=org.opencontainers.image.url=https://github.com/outsystems/chisel
28+
- --label=org.opencontainers.image.source=https://github.com/outsystems/chisel
29+
- --label=org.opencontainers.image.version={{ .Version }}
30+
- --label=org.opencontainers.image.created={{ .Date }}
31+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
32+
checksum:
33+
name_template: 'checksums.txt'
34+
snapshot:
35+
name_template: "{{ incpatch .Version }}-next"
36+
changelog:
37+
sort: asc
38+
filters:
39+
exclude:
40+
- "^docs:"
41+
- "^test:"

0 commit comments

Comments
 (0)