commit d2245b54e4a7a465b434a2e10f80b13a9cbcd16f Author: 编码猿 Date: Tue Feb 4 19:00:02 2025 +0800 first commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e8de592 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM ubuntu:latest + +# 设置为阿里的镜像源 +RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list +RUN sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list + +# 清除缓存 并 更新 +RUN apt-get clean && apt-get update + +# 安装 git 和一些基础工具 +RUN apt-get install -y sshpass git git-lfs curl + +# 安装nodejs 23版本 +RUN curl -fsSL https://deb.nodesource.com/setup_23.x -o nodesource_setup.sh +RUN bash nodesource_setup.sh +RUN apt-get install -y nodejs + +# 设置npm镜像地址 +RUN npm config set registry https://registry.npmmirror.com +# 删除 nodejs 安装脚本 +RUN rm -rf /nodesource_setup.sh + +# 配置git账户和邮箱 +RUN git config --global user.name "bmy" && git config --global user.email "2271608011@qq.com" +# 取消git对ssl证书的验证,让 drone 可以顺利克隆代码 +RUN git config --global http.sslVerify "false" + +CMD ["/bin/bash"] + + diff --git a/命令记录.txt b/命令记录.txt new file mode 100644 index 0000000..d1d690e --- /dev/null +++ b/命令记录.txt @@ -0,0 +1,16 @@ +构建打包镜像 +docker build -t 2271608011/bmygit:v1.2 . + +进入镜像 +docker run -it 2271608011/bmygit:v1.2 /bin/bash + +登录 +docker login + +给镜像打 tag +docker tag bmy/git:v1.2 2271608011/bmy/git:v1.2 + +docker tag <要push的镜像> <传到dockerhub上的路径> + +推送 +docker push 2271608011/bmygit:v1.2 \ No newline at end of file