build(docker): support configurable package mirrors
giteabot backport / giteabot (push) Canceled after 0s
release-nightly / nightly-binary (push) Canceled after 0s
release-nightly / nightly-container (push) Canceled after 0s
giteabot / giteabot (push) Canceled after 0s
release-nightly-snapcraft / build-and-publish (push) Canceled after 0s
giteabot backport / giteabot (push) Canceled after 0s
release-nightly / nightly-binary (push) Canceled after 0s
release-nightly / nightly-container (push) Canceled after 0s
giteabot / giteabot (push) Canceled after 0s
release-nightly-snapcraft / build-and-publish (push) Canceled after 0s
Assisted-by: Codex:GPT-5
This commit is contained in:
+15
-4
@@ -1,10 +1,15 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
# Build frontend on the native platform to avoid QEMU-related issues with nodejs ecosystem
|
# Build frontend on the native platform to avoid QEMU-related issues with nodejs ecosystem
|
||||||
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.26-alpine3.24 AS frontend-build
|
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.26-alpine3.24 AS frontend-build
|
||||||
RUN apk --no-cache add build-base git nodejs pnpm
|
ARG ALPINE_MIRROR=""
|
||||||
|
ARG NPM_REGISTRY=""
|
||||||
|
RUN if [ -n "$ALPINE_MIRROR" ]; then sed -i "s|https://dl-cdn.alpinelinux.org/alpine|$ALPINE_MIRROR|g" /etc/apk/repositories; fi && \
|
||||||
|
apk --no-cache add build-base git nodejs pnpm
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
||||||
RUN --mount=type=cache,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile
|
RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
|
||||||
|
if [ -n "$NPM_REGISTRY" ]; then pnpm config set registry "$NPM_REGISTRY"; fi && \
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
COPY --exclude=.git/ . .
|
COPY --exclude=.git/ . .
|
||||||
RUN make frontend
|
RUN make frontend
|
||||||
|
|
||||||
@@ -15,9 +20,13 @@ ARG GITEA_VERSION
|
|||||||
ARG TAGS=""
|
ARG TAGS=""
|
||||||
ENV TAGS="bindata timetzdata $TAGS"
|
ENV TAGS="bindata timetzdata $TAGS"
|
||||||
ARG CGO_EXTRA_CFLAGS
|
ARG CGO_EXTRA_CFLAGS
|
||||||
|
ARG ALPINE_MIRROR=""
|
||||||
|
ARG GOPROXY=https://proxy.golang.org,direct
|
||||||
|
ENV GOPROXY=$GOPROXY
|
||||||
|
|
||||||
# Build deps
|
# Build deps
|
||||||
RUN apk --no-cache add \
|
RUN if [ -n "$ALPINE_MIRROR" ]; then sed -i "s|https://dl-cdn.alpinelinux.org/alpine|$ALPINE_MIRROR|g" /etc/apk/repositories; fi && \
|
||||||
|
apk --no-cache add \
|
||||||
build-base \
|
build-base \
|
||||||
git
|
git
|
||||||
|
|
||||||
@@ -48,7 +57,9 @@ FROM docker.io/library/alpine:3.24 AS gitea
|
|||||||
|
|
||||||
EXPOSE 22 3000
|
EXPOSE 22 3000
|
||||||
|
|
||||||
RUN apk --no-cache add \
|
ARG ALPINE_MIRROR=""
|
||||||
|
RUN if [ -n "$ALPINE_MIRROR" ]; then sed -i "s|https://dl-cdn.alpinelinux.org/alpine|$ALPINE_MIRROR|g" /etc/apk/repositories; fi && \
|
||||||
|
apk --no-cache add \
|
||||||
bash \
|
bash \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
curl \
|
curl \
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ../..
|
context: ../..
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
ALPINE_MIRROR: https://mirrors.aliyun.com/alpine
|
||||||
|
GOPROXY: https://goproxy.cn,direct
|
||||||
|
NPM_REGISTRY: https://registry.npmmirror.com
|
||||||
image: roncarve/gita:1.27.2-production
|
image: roncarve/gita:1.27.2-production
|
||||||
container_name: gitea
|
container_name: gitea
|
||||||
hostname: git.roncarve.com
|
hostname: git.roncarve.com
|
||||||
|
|||||||
Reference in New Issue
Block a user