docker镜像构建
- 使用阿里云加速
- 安装常用的python3与java
# 使用 Ubuntu 为基础镜像
FROM ubuntu:22.04
# 避免安装时出现交互式提示
ARG DEBIAN_FRONTEND=noninteractive
RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak; \
sed -i 's#http://archive.ubuntu.com/#http://mirrors.aliyun.com/#' /etc/apt/sources.list; \
sed -i 's#http://ports.ubuntu.com/#http://mirrors.aliyun.com/#' /etc/apt/sources.list; \
sed -i 's#http://security.ubuntu.com/#http://mirrors.aliyun.com/#' /etc/apt/sources.list; \
apt-get update;
# 安装 Java
RUN apt-get install -y openjdk-11-jdk
# 安装 Python
RUN apt-get install -y python3 python3-pip python3-venv;\
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple;\
pip config set install.trusted-host mirrors.aliyun.com;\
pip install virtualenv
RUN apt-get install -y git
CMD bash
构建多平台镜像
docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 .