Skip to content

Commit

Permalink
🚀 generate runtimes.yml when building images
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaNecron committed Jan 6, 2024
1 parent bcf0a5f commit 25a4293
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
type=ref,event=pr,prefix=pr-,suffix=suffix=-${{ matrix.variant }}
type=pep440,pattern={{version}},suffix=-${{ matrix.variant }}
type=raw,${{ matrix.variant }}
type=sha,prefix=,suffix=-${{ matrix.variant }}
type=sha,prefix=,suffix=_${{ matrix.variant }}
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker BuildX
Expand Down
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,25 @@ RUN go mod download
COPY .. .

RUN --mount=type=cache,target=/go/pkg/mod for variant in tier1 tier2 tier3; do GOOS=${TARGETOS} GOARCH=${TARGETARCH} make release OUT="./out/igloo.${variant}" VARIANT=${variant}; done
RUN --mount=type=cache,target=/go/pkg/mod GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o ./out/gen_runtimes ./cmd/gen_runtimes

FROM --platform=${BUILDPLATFORM} alphanecron/judge-env:tier-1 AS tier-1
WORKDIR /igloo

COPY --from=builder /usr/src/app/out/igloo.tier1 ./igloo
COPY --from=builder /usr/src/app/out/gen_runtimes ./gen_runtimes

RUN ./gen_runtimes

ENTRYPOINT ["/igloo/igloo"]

FROM --platform=${BUILDPLATFORM} alphanecron/judge-env:tier-2 AS tier-2
WORKDIR /igloo

COPY --from=builder /usr/src/app/out/igloo.tier2 ./igloo
COPY --from=builder /usr/src/app/out/gen_runtimes ./gen_runtimes

RUN ./gen_runtimes

ENTRYPOINT ["/igloo/igloo"]

Expand Down
3 changes: 0 additions & 3 deletions worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"math"
"runtime"
"slices"
"strings"
"sync/atomic"
)

Expand Down Expand Up @@ -141,8 +140,6 @@ func (w *JudgeWorker) Judge(r *_runner, sub types.Submission) {
})
finalResult := judge()
if finalResult != nil {
// replace actual new line characters with \\n to avoid shattered payloads when serializing response with msgpack
finalResult.CompilerOutput = strings.ReplaceAll(finalResult.CompilerOutput, "\n", "\\n")
logger.Logger.Debug().Interface("result", finalResult).Interface("submission", sub).Msg("final result")
}
prod.Report(types.ResultFinal, finalResult)
Expand Down

0 comments on commit 25a4293

Please sign in to comment.