forked from groob/moroz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44408b5
commit 24d594a
Showing
3 changed files
with
28 additions
and
46 deletions.
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,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux -o pipefail | ||
|
||
cd cmd/moroz | ||
|
||
export GOOS="linux" | ||
|
||
for GOARCH in "amd64" "arm64" | ||
do | ||
export GOARCH="${GOARCH}" | ||
mkdir -p ../../build/${GOOS}/${GOARCH} | ||
go build -o ../../build/${GOOS}/${GOARCH}/moroz . | ||
done |
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 |
---|---|---|
@@ -1,51 +1,15 @@ | ||
name: build-push-image | ||
name: Build, test and push image | ||
|
||
concurrency: ${{ github.ref }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout cod | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23' | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Build the Go application | ||
run: | | ||
mkdir -p build/linux | ||
cd cmd/moroz | ||
go build -o ../../build/linux/moroz . | ||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build the Docker image | ||
run: docker build -t ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:latest . | ||
|
||
- name: Push the Docker image | ||
run: docker push ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:latest | ||
build-test-image: | ||
uses: portswigger-apps/shared-workflows/.github/workflows/build-test-image.yaml@main | ||
secrets: inherit | ||
with: | ||
setup-go: true |
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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
FROM alpine:3.20 | ||
|
||
ARG TARGETPLATFORM | ||
|
||
RUN apk --update add \ | ||
ca-certificates | ||
|
||
COPY ./build/linux/moroz /usr/bin/moroz | ||
RUN mkdir /app | ||
|
||
COPY build/${TARGETPLATFORM}/moroz /app/moroz | ||
|
||
CMD ["moroz"] |