- Rename Dockerfile.boot to Dockerfile.prod for consistency - Add Dockerfile.jdk21-maven custom base image * Pre-installed Maven 3.8.8 from Apache binary * Pre-configured timezone and build tools * Eliminates apt update on every build (saves 2-3 minutes) - Update CI workflow to use Dockerfile.prod - Update pnpm-lock.yaml with missing dependencies Benefits: ✅ Faster CI/CD builds (skip apt operations) ✅ All images from Harbor registry ✅ Reusable base image for Java projects ✅ Stable Maven installation using official binary 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
43 lines
1.4 KiB
Docker
43 lines
1.4 KiB
Docker
# ============================================================================
|
|
# LJWX JDK21 + Maven 基础镜像
|
|
# 用途: 为Java项目提供预装Maven的JDK21环境,避免每次构建都apt update
|
|
# 构建命令: docker build -f Dockerfile.jdk21-maven -t harbor.omniverseai.net/ljwx/jdk21-maven:latest .
|
|
# 推送命令: docker push harbor.omniverseai.net/ljwx/jdk21-maven:latest
|
|
# ============================================================================
|
|
|
|
FROM harbor.omniverseai.net/ljwx/jdk21:latest
|
|
|
|
LABEL maintainer="[email protected]"
|
|
LABEL description="JDK 21 with Maven and build tools for LJWX projects"
|
|
|
|
# 设置时区
|
|
ENV TZ='Asia/Shanghai'
|
|
|
|
# 安装基础工具
|
|
RUN apt-get update && \
|
|
apt-get install -y \
|
|
wget \
|
|
curl \
|
|
git \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 配置时区
|
|
RUN ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && \
|
|
echo "$TZ" > /etc/timezone
|
|
|
|
# 手动安装Maven (避免apt包的classpath问题)
|
|
ENV MAVEN_VERSION=3.8.8
|
|
ENV MAVEN_HOME=/opt/maven
|
|
ENV PATH="${MAVEN_HOME}/bin:${PATH}"
|
|
|
|
RUN wget https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz -O /tmp/maven.tar.gz && \
|
|
mkdir -p ${MAVEN_HOME} && \
|
|
tar -xzf /tmp/maven.tar.gz -C ${MAVEN_HOME} --strip-components=1 && \
|
|
rm /tmp/maven.tar.gz
|
|
|
|
# 验证安装
|
|
RUN java -version && mvn -version
|
|
|
|
CMD ["/bin/bash"]
|