update
This commit is contained in:
parent
d54a0b84bb
commit
fc79d5d350
14
alpine-3.12/Dockerfile
Normal file
14
alpine-3.12/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
FROM alpine:3.12
|
||||||
|
MAINTAINER Colben colbenlee@gmail.com
|
||||||
|
ADD --chown=root:root /ADD/ /etc/
|
||||||
|
RUN echo -e 'https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.12/main\n\
|
||||||
|
https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.12/community\n\
|
||||||
|
' > /etc/apk/repositories \
|
||||||
|
&& apk update \
|
||||||
|
&& apk add --no-cache bash curl coreutils iproute2 \
|
||||||
|
&& echo "alias ls='ls --color=auto'" >> /root/.bashrc \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
|
ENV PS1='\[\e[33;1;1m\][\[\e[0m\]\[\e[35;1m\]\u\[\e[0m\]\[\e[33;1;1m\]@\[\e[0m\]\[\e[31;1;1m\]docker\[\e[0m\]\[\e[32;1;1m\](\h)\[\e[0m\]\[\e[33;1;1m\]:\[\e[0m\]\[\e[32m\]\w\[\e[0m\]\[\e[33;1;1m\]]\[\e[0m\]\[\e[36m\]\$\[\e[0m\] '
|
||||||
|
ENV PS2='\[\e[36m\]>\[\e[0m\] '
|
||||||
|
ENV LANG=en_US.UTF-8
|
||||||
|
|
11
alpine-3.12/README.md
Normal file
11
alpine-3.12/README.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# 构建 alpine 镜像
|
||||||
|
|
||||||
|
## 导入文件
|
||||||
|
- 本机时区 /etc/localtime
|
||||||
|
|
||||||
|
## 定制
|
||||||
|
- 使用 Asia/Shanghai 时区
|
||||||
|
- 修改软件源,开启 edge
|
||||||
|
- 安装 bash curl coreutils iproute2
|
||||||
|
- 默认语言 en_US.UTF-8
|
||||||
|
|
69
alpine-3.12/alpine.sh
Executable file
69
alpine-3.12/alpine.sh
Executable file
@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=========================================
|
||||||
|
# Author : colben
|
||||||
|
#=========================================
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
|
|
||||||
|
[ 'x86_64' == "$(uname -m)" ] && ARCH='' || ARCH="-$(uname -m)"
|
||||||
|
ROOT_DIR="$(cd $(dirname $0) && pwd)"
|
||||||
|
IMAGE="harbor.colben.cn/general/$(basename ${0%.sh})$ARCH:3.12"
|
||||||
|
|
||||||
|
if [ -t 0 ]; then
|
||||||
|
function Print { echo -e "\033[36;1m$(date +'[%F %T]')\033[32;1m $*\033[0m"; }
|
||||||
|
function Warn { echo -e "\033[36;1m$(date +'[%F %T]')\033[33;1m $*\033[0m"; }
|
||||||
|
function Error { echo -e "\033[36;1m$(date +'[%F %T]')\033[31;1m $*\033[0m"; exit 1; }
|
||||||
|
else
|
||||||
|
function Print { echo -e "$(date +'[%F %T INFO]') $*"; }
|
||||||
|
function Warn { echo -e "$(date +'[%F %T WARN]') $*"; }
|
||||||
|
function Error { echo -e "$(date +'[%F %T ERROR]') $*"; exit 1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
function Quit {
|
||||||
|
local exitCode=$?
|
||||||
|
[ 0 -ne $exitCode ] && Error Failed to build or push image!
|
||||||
|
[ -z "${END:-}" ] && echo && Error Interrupted manually!
|
||||||
|
Print Succeeded to build and push image.
|
||||||
|
}
|
||||||
|
|
||||||
|
function YesOrNo {
|
||||||
|
Warn $*
|
||||||
|
local sw=
|
||||||
|
while :; do
|
||||||
|
read -p '(Yes/No/Quit) ' -n1 sw
|
||||||
|
[[ "$sw" =~ ^Y|y$ ]] && echo && return 0
|
||||||
|
[[ "$sw" =~ ^N|n$ ]] && echo && return 1
|
||||||
|
[[ "$sw" =~ ^Q|q$ ]] && echo && exit 0
|
||||||
|
[ -n "$sw" ] && echo
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function Update {
|
||||||
|
Warn Preparing localtime ...
|
||||||
|
cd $ROOT_DIR
|
||||||
|
cp -f /etc/localtime ADD/
|
||||||
|
}
|
||||||
|
|
||||||
|
function Build {
|
||||||
|
local yn
|
||||||
|
cd $ROOT_DIR
|
||||||
|
docker images --format='{{.Repository}}:{{.Tag}}' | grep "^$IMAGE$" \
|
||||||
|
&& Warn Removing image $IMAGE ... \
|
||||||
|
&& docker rmi $IMAGE
|
||||||
|
Warn Building image: $IMAGE ...
|
||||||
|
docker build --force-rm -t $IMAGE .
|
||||||
|
YesOrNo Push image: $IMAGE? && docker push $IMAGE
|
||||||
|
}
|
||||||
|
|
||||||
|
function Main {
|
||||||
|
trap Quit EXIT
|
||||||
|
Update
|
||||||
|
Build
|
||||||
|
END=1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Start here
|
||||||
|
Main
|
||||||
|
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
- 创建目录
|
- 创建目录
|
||||||
```
|
```
|
||||||
grep '\<source:' docker-compose.yml cut -d: -f2 | xargs mkdir -p
|
grep '\<source:' docker-compose.yml | cut -d: -f2 | xargs mkdir -p
|
||||||
```
|
```
|
||||||
|
|
||||||
- 启动
|
- 启动
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
- 创建目录
|
- 创建目录
|
||||||
```
|
```
|
||||||
grep '\<source:' docker-compose.yml cut -d: -f2 | xargs mkdir -p
|
grep '\<source:' docker-compose.yml | cut -d: -f2 | xargs mkdir -p
|
||||||
```
|
```
|
||||||
|
|
||||||
- 启动
|
- 启动
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
- 创建目录
|
- 创建目录
|
||||||
```
|
```
|
||||||
grep '\<source:' docker-compose.yml cut -d: -f2 | xargs mkdir -p
|
grep '\<source:' docker-compose.yml | cut -d: -f2 | xargs mkdir -p
|
||||||
```
|
```
|
||||||
|
|
||||||
- 启动
|
- 启动
|
||||||
|
@ -34,12 +34,12 @@ function Quit {
|
|||||||
|
|
||||||
function StartProc {
|
function StartProc {
|
||||||
Print Starting rsync ...
|
Print Starting rsync ...
|
||||||
rm -f /var/run/rsyncd.pid
|
rm -f $LOG_DIR/rsyncd.pid
|
||||||
rsync --daemon \
|
rsync --daemon \
|
||||||
--no-detach \
|
--no-detach \
|
||||||
--port=873 \
|
--port=873 \
|
||||||
--log-file=$LOG_DIR/rsyncd.log \
|
--log-file=$LOG_DIR/rsyncd.log \
|
||||||
--dparam=pidfile=/var/run/rsyncd.pid \
|
--dparam=pidfile=$LOG_DIR/rsyncd.pid \
|
||||||
&>> $LOG_DIR/rsyncd.out &
|
&>> $LOG_DIR/rsyncd.out &
|
||||||
PIDS="$PIDS $!"
|
PIDS="$PIDS $!"
|
||||||
Print Rsync started.
|
Print Rsync started.
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
ARG ARCH
|
ARG ARCH
|
||||||
FROM harbor.colben.cn/general/alpine$ARCH
|
FROM harbor.colben.cn/general/alpine$ARCH:3.12
|
||||||
MAINTAINER Colben colbenlee@gmail.com
|
MAINTAINER Colben colbenlee@gmail.com
|
||||||
ADD --chown=root:root /ADD/ /opt/
|
ADD --chown=root:root /ADD/ /opt/
|
||||||
RUN apk update \
|
RUN apk update \
|
||||||
&& apk add --no-cache rsync \
|
&& apk add --no-cache rsync inotify-tools \
|
||||||
&& mkdir -p /var/log/rsync \
|
&& mkdir -p /var/log/rsync \
|
||||||
&& rm -rf /var/cache/apk/*
|
&& rm -rf /var/cache/apk/*
|
||||||
CMD ["/opt/ccmd"]
|
CMD ["/opt/ccmd"]
|
||||||
|
@ -9,7 +9,7 @@ export LANG=en_US.UTF-8
|
|||||||
|
|
||||||
[ 'x86_64' == "$(uname -m)" ] && ARCH='' || ARCH="-$(uname -m)"
|
[ 'x86_64' == "$(uname -m)" ] && ARCH='' || ARCH="-$(uname -m)"
|
||||||
ROOT_DIR="$(cd $(dirname $0) && pwd)"
|
ROOT_DIR="$(cd $(dirname $0) && pwd)"
|
||||||
IMAGE="harbor.colben.cn/general/$(basename ${0%.sh})$ARCH:latest"
|
IMAGE="harbor.colben.cn/general/$(basename ${0%.sh})$ARCH:3.1.3"
|
||||||
|
|
||||||
if [ -t 0 ]; then
|
if [ -t 0 ]; then
|
||||||
function Print { echo -e "\033[36;1m$(date +'[%F %T]')\033[32;1m $*\033[0m"; }
|
function Print { echo -e "\033[36;1m$(date +'[%F %T]')\033[32;1m $*\033[0m"; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user