Skip to content

Commit

Permalink
PLAT-546 - moe to shared workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
portswigger-ben committed Sep 2, 2024
1 parent 44408b5 commit 24d594a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 46 deletions.
14 changes: 14 additions & 0 deletions .ci/build.sh
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
54 changes: 9 additions & 45 deletions .github/workflows/build-push-Image.yaml
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
6 changes: 5 additions & 1 deletion Dockerfile
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"]

0 comments on commit 24d594a

Please sign in to comment.