add ARG CONTRY=CN to improve the alpinelinux install speed
This commit is contained in:
@@ -32,7 +32,13 @@ FROM node:18-alpine AS builder-admin-frontend
|
|||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /frontend
|
WORKDIR /frontend
|
||||||
|
|
||||||
RUN apk update && apk add git --no-cache
|
ARG COUNTRY
|
||||||
|
# Install required tools without caching index to minimize image size
|
||||||
|
RUN if [ "$COUNTRY" = "CN" ] ; then \
|
||||||
|
echo "It is in China, updating the repositories"; \
|
||||||
|
sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.tuna.tsinghua.edu.cn/alpine#g' /etc/apk/repositories; \
|
||||||
|
fi && \
|
||||||
|
apk update && apk add --no-cache git
|
||||||
|
|
||||||
# Clone the frontend repository
|
# Clone the frontend repository
|
||||||
RUN git clone https://github.com/lejianwen/rustdesk-api-web .
|
RUN git clone https://github.com/lejianwen/rustdesk-api-web .
|
||||||
@@ -47,7 +53,13 @@ FROM alpine:latest
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install necessary runtime dependencies
|
# Install necessary runtime dependencies
|
||||||
RUN apk add --no-cache tzdata file
|
# Install required tools without caching index to minimize image size
|
||||||
|
ARG COUNTRY
|
||||||
|
RUN if [ "$COUNTRY" = "CN" ] ; then \
|
||||||
|
echo "It is in China, updating the repositories"; \
|
||||||
|
sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.tuna.tsinghua.edu.cn/alpine#g' /etc/apk/repositories; \
|
||||||
|
fi && \
|
||||||
|
apk update && apk add --no-cache tzdata file
|
||||||
|
|
||||||
# Copy the built application and resources from the builder stage
|
# Copy the built application and resources from the builder stage
|
||||||
COPY --from=builder-backend /app/release /app/
|
COPY --from=builder-backend /app/release /app/
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.dev
|
dockerfile: Dockerfile.dev
|
||||||
|
args:
|
||||||
|
COUNTRY: CN
|
||||||
# image: lejianwen/rustdesk-api
|
# image: lejianwen/rustdesk-api
|
||||||
container_name: rustdesk-api
|
container_name: rustdesk-api
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
Reference in New Issue
Block a user