forgejo/Dockerfile.ci

83 lines
1.7 KiB
Docker

FROM alpine:3.17.0 as prep
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
RUN apk --no-cache add xz upx bash && \
mkdir -p /docker/bin && \
mkdir /dist && \
date > /date.dummy && \
ls /
ENV USER git
ARG DEFAULTTAGNAME
ARG CI_COMMIT_TAG
ENV DEFAULTTAGNAME=${DEFAULTTAGNAME:-main}
COPY docker /docker/
COPY dist /dist/
RUN /docker/map-binaries.sh /dist/binaries "true" forgejo ${CI_COMMIT_TAG##v} && \
/docker/map-binaries.sh /dist/contrib "false" environment-to-ini ${CI_COMMIT_TAG##v}
RUN chmod 755 /docker/root/usr/bin/entrypoint /docker/root/etc/s6/gitea/* /docker/root/etc/s6/openssh/* /docker/root/etc/s6/.s6-svscan/* && \
find /docker/bin -name 'forgejo' -type f | xargs -I{} /bin/chmod 0755 {} && \
find /docker/bin -name 'environment-to-ini' -type f | xargs -I{} /bin/chmod 0755 {}
FROM alpine:3.17.0
LABEL maintainer="contact@forgejo.org"
ARG TARGETPLATFORM
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
EXPOSE 22 3000
#regrouped as updates to it should happen less frequently
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
RUN apk --no-cache add \
bash \
ca-certificates \
curl \
gettext \
git \
linux-pam \
openssh \
s6 \
sqlite \
su-exec \
gnupg \
tzdata
ENV USER git
ENV GITEA_CUSTOM /data/gitea
VOLUME ["/data"]
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["/bin/s6-svscan", "/etc/s6"]
COPY --from=prep /docker/root /
COPY --from=prep /docker/bin/$TARGETPLATFORM/forgejo /app/gitea/gitea
COPY --from=prep /docker/bin/$TARGETPLATFORM/environment-to-ini /usr/local/bin/environment-to-ini