1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# 国内服务器可设 REGISTRY_MIRROR 拉取镜像,例: docker.m.daocloud.io/library/
|
# 国内默认走镜像;海外可 --build-arg REGISTRY_MIRROR= 直连
|
||||||
ARG REGISTRY_MIRROR=
|
ARG REGISTRY_MIRROR=docker.m.daocloud.io/library/
|
||||||
FROM ${REGISTRY_MIRROR}node:20-alpine AS builder
|
FROM ${REGISTRY_MIRROR}node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json* ./
|
||||||
@@ -7,7 +7,7 @@ RUN npm ci --legacy-peer-deps 2>/dev/null || npm install --legacy-peer-deps
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
ARG REGISTRY_MIRROR=
|
ARG REGISTRY_MIRROR=docker.m.daocloud.io/library/
|
||||||
FROM ${REGISTRY_MIRROR}nginx:alpine
|
FROM ${REGISTRY_MIRROR}nginx:alpine
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
RUN echo 'server { listen 80; location /admin/ { alias /usr/share/nginx/html/; try_files $uri $uri/ /admin/index.html; } }' > /etc/nginx/conf.d/default.conf
|
RUN echo 'server { listen 80; location /admin/ { alias /usr/share/nginx/html/; try_files $uri $uri/ /admin/index.html; } }' > /etc/nginx/conf.d/default.conf
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# 需在项目根目录构建: docker build -f server/Dockerfile .
|
# 需在项目根目录构建: docker build -f server/Dockerfile .
|
||||||
# 使用 vendor 构建,无需在构建时访问 proxy.golang.org(服务器无外网时也能 build)
|
# 使用 vendor 构建,无需在构建时访问 proxy.golang.org(服务器无外网时也能 build)
|
||||||
# 国内服务器可设 REGISTRY_MIRROR 拉取镜像,例: docker.m.daocloud.io/library/
|
# 国内默认走镜像;海外可 --build-arg REGISTRY_MIRROR= 直连
|
||||||
ARG REGISTRY_MIRROR=
|
ARG REGISTRY_MIRROR=docker.m.daocloud.io/library/
|
||||||
FROM ${REGISTRY_MIRROR}golang:1.21-alpine AS builder
|
FROM ${REGISTRY_MIRROR}golang:1.21-alpine AS builder
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY server/ ./
|
COPY server/ ./
|
||||||
@@ -10,7 +10,7 @@ ARG GOPROXY=https://goproxy.cn,direct
|
|||||||
ENV GOPROXY=$GOPROXY
|
ENV GOPROXY=$GOPROXY
|
||||||
RUN CGO_ENABLED=0 go build -mod=vendor -o /app/server .
|
RUN CGO_ENABLED=0 go build -mod=vendor -o /app/server .
|
||||||
|
|
||||||
ARG REGISTRY_MIRROR=
|
ARG REGISTRY_MIRROR=docker.m.daocloud.io/library/
|
||||||
FROM ${REGISTRY_MIRROR}alpine:3.19
|
FROM ${REGISTRY_MIRROR}alpine:3.19
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache ca-certificates tzdata
|
RUN apk add --no-cache ca-certificates tzdata
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# 国内服务器可设 REGISTRY_MIRROR 拉取镜像,例: docker.m.daocloud.io
|
# 国内默认走镜像;海外可构建时传 --build-arg REGISTRY_MIRROR= 直连
|
||||||
ARG REGISTRY_MIRROR=
|
ARG REGISTRY_MIRROR=docker.m.daocloud.io/library/
|
||||||
FROM ${REGISTRY_MIRROR}node:20-alpine AS builder
|
FROM ${REGISTRY_MIRROR}node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json* ./
|
||||||
@@ -7,7 +7,7 @@ RUN npm ci --legacy-peer-deps 2>/dev/null || npm install --legacy-peer-deps
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
ARG REGISTRY_MIRROR=
|
ARG REGISTRY_MIRROR=docker.m.daocloud.io/library/
|
||||||
FROM ${REGISTRY_MIRROR}nginx:alpine
|
FROM ${REGISTRY_MIRROR}nginx:alpine
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
RUN echo 'server { listen 80; root /usr/share/nginx/html; index index.html; location / { try_files $uri $uri/ /index.html; } }' > /etc/nginx/conf.d/default.conf
|
RUN echo 'server { listen 80; root /usr/share/nginx/html; index index.html; location / { try_files $uri $uri/ /index.html; } }' > /etc/nginx/conf.d/default.conf
|
||||||
|
|||||||
Reference in New Issue
Block a user