# 指定基础镜像
FROM node:14-alpine
## 配置npm淘宝镜像
RUN npm config set registry https://registry.npmmirror.com
## 替换源
# 替换阿里云的源
RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories
# 安装vue-cli脚手架工具
# RUN npm install -g @vue/cli@4.5.13
## 安装ssh,配置开机自启动
RUN apk update
RUN apk add openssh --no-cache
RUN sed -i "s/#Port.*/Port 22/g" /etc/ssh/sshd_config
RUN sed -i "s/#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config
RUN apk add openrc --no-cache
RUN ssh-keygen -A
RUN rc-status
RUN touch /run/openrc/softlevel
RUN /etc/init.d/sshd restart
RUN touch /run/openrc/softlevel
RUN rc-update add sshd
# 指定项目监听的端口
# EXPOSE 22
## time zone(配置镜像时区)
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# ## 入口,java项目的启动命令
# # ENTRYPOINT ["java", "-jar", "/app.jar"]
# ######构建镜像######
# ###### docker build -f Dockerfile-node -t node14.21-alpine3.19:v1 .
# ###### docker build -f Dockerfile-vue -t node20.13-vue4.5-ubuntu18.04:v1 .
05-08
1291
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-12
07-27