-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from golioth/feat/img-build
Add CI workflow to build and publish images
- Loading branch information
Showing
4 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: CI | ||
on: | ||
workflow_dispatch: {} | ||
pull_request: {} | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build_publish: | ||
name: Build and Publish | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build and Export to Docker | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./images/xk6-coap/Dockerfile | ||
platforms: linux/amd64 | ||
load: true | ||
tags: goliothiot/xk6-coap | ||
|
||
- name: Login to Dockerhub | ||
uses: docker/login-action@v1 | ||
if: github.ref == 'refs/heads/main' | ||
with: | ||
username: goliothiot | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
- name: Build and Push to Dockerhub | ||
uses: docker/build-push-action@v4 | ||
if: github.ref == 'refs/heads/main' | ||
with: | ||
context: . | ||
file: ./images/xk6-coap/Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: goliothiot/xk6-coap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# golang:1.20.5 | ||
FROM golang@sha256:6b3fa4b908676231b50acbbc00e84d8cee9c6ce072b1175c0ff352c57d8a612f as build | ||
|
||
WORKDIR /build | ||
|
||
COPY . ./ | ||
|
||
RUN make build | ||
|
||
# gcr.io/distroless/static:nonroot | ||
FROM gcr.io/distroless/static@sha256:9ecc53c269509f63c69a266168e4a687c7eb8c0cfd753bd8bfcaa4f58a90876f | ||
|
||
COPY --from=build /build/k6 /usr/local/bin/k6 |