-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (39 loc) · 1.11 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM golang:1.21.1-alpine3.17 AS build
# install system dependencies
RUN apk add make
WORKDIR /build
# copy project files
COPY cmd/ cmd/
COPY internal/ internal/
COPY pkg/ pkg/
COPY Makefile Makefile
COPY go.mod go.mod
COPY go.sum go.sum
# build binary to /build/bin/code-racer
# RUN --mount=type=cache,target=/go/pkg/mod/ make build
RUN make build
COPY ./entrypoint.sh ./entrypoint.sh
FROM golang:1.21.1-alpine3.17 as nosocketbuild
ARG TARGETOS TARGETARCH
RUN apk add clang lld
ENV GOOS=$TARGETOS
ENV GOARCH=$TARGETARCH
ENV CGO_ENABLED=1
RUN apk add pkgconfig musl-dev gcc libseccomp-dev make
WORKDIR /build
COPY cmd/ cmd/
COPY Makefile Makefile
COPY go.mod go.mod
COPY go.sum go.sum
# build nosocket binary to /build/bin/nosocket
# RUN --mount=type=cache,target=/go/pkg/mod/ make nosocket
RUN make nosocket
FROM debian:12 as final
COPY --from=build /build/bin/code-racer /bin/code-racer
COPY --from=nosocketbuild /build/bin/nosocket /bin/nosocket
COPY --from=build /build/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY runners/ runners/
COPY manifest.yml manifest.yml
EXPOSE 8000
ENTRYPOINT [ "./entrypoint.sh" ]