summaryrefslogtreecommitdiffstats
path: root/Dockerfile
blob: ce36d7a45984e05a8adf6588b8bd28425e74fe33 (plain)
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
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx

FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.21-alpine3.18 as build-env

#
# Transparently cross compile for the target platform
#
COPY --from=xx / /
ARG TARGETPLATFORM
RUN apk --no-cache add clang lld
RUN xx-apk --no-cache add gcc musl-dev
RUN xx-go --wrap

# Do not remove `git` here, it is required for getting runner version when executing `make build`
RUN apk add --no-cache build-base git

COPY . /srv
WORKDIR /srv

RUN make clean && make build

FROM docker.io/library/alpine:3.18
LABEL maintainer="contact@forgejo.org"

RUN apk add --no-cache git bash

COPY --from=build-env /srv/forgejo-runner /bin/forgejo-runner

ENV HOME=/data

USER 1000:1000

WORKDIR /data

VOLUME ["/data"]

CMD ["/bin/forgejo-runner"]