forgejo/Dockerfile

86 lines
2.3 KiB
Docker
Raw Normal View History

2023-06-14 13:32:20 +02:00
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.20-alpine3.18 as build-env
ARG GOPROXY
ENV GOPROXY ${GOPROXY:-direct}
ARG GITEA_VERSION
ARG TAGS="sqlite sqlite_unlock_notify"
2020-09-28 00:52:22 +02:00
ENV TAGS "bindata timetzdata $TAGS"
ARG CGO_EXTRA_CFLAGS
2023-06-14 13:32:20 +02:00
#
# 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
ENV CGO_ENABLED=1
RUN xx-go --wrap
#
# for go generate and binfmt to find
# without it the generate phase will fail with
# #19 25.04 modules/public/public_bindata.go:8: running "go": exit status 1
# #19 25.39 aarch64-binfmt-P: Could not open '/lib/ld-musl-aarch64.so.1': No such file or directory
# why exactly is it needed? where is binfmt involved?
#
RUN cp /*-alpine-linux-musl*/lib/ld-musl-*.so.1 /lib || true
RUN apk --no-cache add build-base git nodejs npm
COPY . ${GOPATH}/src/code.gitea.io/gitea
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
2023-06-14 13:32:20 +02:00
RUN make clean-all
RUN make frontend
RUN go build contrib/environment-to-ini/environment-to-ini.go && xx-verify environment-to-ini
RUN make go-check generate-backend static-executable && xx-verify gitea
FROM docker.io/library/alpine:3.18
[CI] implementation: forgejo container images (cherry picked from commit dd1971d4e60f37fb76daeb6cef8b1defcc957a34) (cherry picked from commit 3981dbaf8c0dd74b0e82a7afc36809998ac775a2) (cherry picked from commit 8dff3cc2d1a51980439e9ca8f1cad592403c558e) (cherry picked from commit e7673e5d2237733e4e17b9386c4bb25bb88fe2e2) (cherry picked from commit 326174064ba6dbd379ea82e9643e23fe684ad96f) (cherry picked from commit eb769dbde4fb0d7a8a4bd74b6bcdf1f1f180f840) (cherry picked from commit 335829ade20a187c7fd423909231d198a59545bd) (cherry picked from commit 5e8e4f549d2224a00387764e93fdbde34e324c3d) Conflicts: Dockerfile Dockerfile.rootless (cherry picked from commit b777fc91d0ba5b1a061bd9cc57c4818a3357b42a) (cherry picked from commit 02cda642ec7ce2b69de7f0ff4fb4f0d70941f54e) (cherry picked from commit 96ef93f3bc1b618831f04e1ae5d5c7c74e2ed36c) (cherry picked from commit aa424551f24364dd43d9b7739b723bb1d914eeaf) Conflicts: Dockerfile Dockerfile.rootless (cherry picked from commit e54fa86e4904047e5670e68a9dd89e76530564a4) (cherry picked from commit 043fa6d6649272f14a65ee2c9cac15b090e66bc9) (cherry picked from commit 805b16248015e8d7ab8c4f514969cff333d432c8) (cherry picked from commit 86bf362a3c8386cc4530c0c4cba46097ed20d8af) (cherry picked from commit 13e0007959fb5e2496b3bbec916036bd2a05a558) (cherry picked from commit 00ff6f7cb3c54ae3a8ed2069b0dd0dddd98e7e6e) (cherry picked from commit 95c7d8e883da495facfbac39db55b5b710ea25a7) (cherry picked from commit 8b3e3f0cdecb70ca3d40d47e4baac3bb8677eeee)
2022-11-25 10:11:23 +01:00
LABEL maintainer="contact@forgejo.org"
2015-08-25 06:41:01 +02:00
EXPOSE 22 3000
2015-08-25 06:41:01 +02:00
RUN apk --no-cache add \
bash \
ca-certificates \
curl \
gettext \
git \
linux-pam \
openssh \
s6 \
sqlite \
su-exec \
gnupg
RUN addgroup \
-S -g 1000 \
git && \
adduser \
-S -H -D \
-h /data/git \
-s /bin/bash \
-u 1000 \
-G git \
git && \
echo "git:*" | chpasswd -e
2015-08-17 09:10:23 +02:00
ENV USER git
ENV GITEA_CUSTOM /data/gitea
VOLUME ["/data"]
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["/bin/s6-svscan", "/etc/s6"]
COPY docker/root /
COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
RUN chmod 755 /usr/bin/entrypoint /app/gitea/gitea /usr/local/bin/gitea /usr/local/bin/environment-to-ini
RUN chmod 755 /etc/s6/gitea/* /etc/s6/openssh/* /etc/s6/.s6-svscan/*
RUN chmod 644 /etc/profile.d/gitea_bash_autocomplete.sh