dockerfile 文件
FROM alpine:edge
ADD install.alpine /install.sh
RUN /install.sh
安装软件的脚本
#!/bin/sh
set -x
op=${1:-all}
apk add --no-cache apk-tools-static
wget -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
function install_app () {
sed -i "s/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g" /etc/apk/repositories
echo 'https://mirrors.ustc.edu.cn/alpine/edge/testing' >> /etc/apk/repositories
apk add --no-cache bash \
sudo \
dbus-x11 \
git \
curl \
emacs-x11 \
openssh-client \
librime \
wget \
gcc \
libc-dev \
librime-dev \
diffutils \
wqy-zenhei \
gzip \
fontconfig \
font-noto-emoji \
opencc \
unzip \
tar \
make \
ttf-dejavu \
ttf-font-awesome \
}
function install_source_code() {
set -euo pipefail
I1FS=#39;\n\t'
mkdir -p /tmp/adodefont
cd /tmp/adodefont
wget -q --show-progress -O source-code-pro.zip https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip
unzip -q source-code-pro.zip -d source-code-pro
mkdir -p ~/.fonts
cp -v source-code-pro/*/OTF/*.otf ~/.fonts/
fc-cache -f
rm -rf source-code-pro{,.zip}
}
function clean_all() {
rm -rf /var/cache/* /tmp/* /var/log/* ~/.cache && mkdir -p /var/cache/apk
}
function all() {
install_app
#install_source_code
clean_all
}
$op
第一次启动后,需要手动运行 /install.sh install_source_code 来安装 source_code 字体,不然 spacemacs 会报告缺失字体。
docker-compose.yml
version: "3"
services:
emacs:
build:
context: .
dockerfile: alpine.Dockerfile
#image: alpine_emacs:28.2
#restart: always
container_name: emacs
entrypoint: /root/entry.sh
environment:
- DISPLAY=$DISPLAY
- LANG=zh-CN.UTF-8
network_mode: "host"
working_dir: "/root"
privileged: true
command: "bash"
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
- ./root:/root:z
- /mnt/:/mnt:z
上面是我的 unraid 上的启动脚本,修改了 entrypoint,主要是想添加一些自定义的变量配置, entry.sh 内容如下:
#!/bin/bash
. /root/.bashrc
tail -f /dev/null
主要就是让容器启动后保持运行状态,这样下次就可以通过 docker exec 来直接运行 emacs 了
本文暂时没有评论,来添加一个吧(●'◡'●)