Skip to content

Commit 17e90b6

Browse files
committed
feat: build emacs docker
1 parent 3f358c0 commit 17e90b6

File tree

3 files changed

+67
-19
lines changed

3 files changed

+67
-19
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
11
name: build
2-
on: [ push, pull_request ]
2+
on:
3+
release:
4+
types: [published, created]
5+
36
jobs:
47
build:
5-
runs-on: ubuntu-latest
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest]
12+
arch: [amd64, arm64]
613
steps:
14+
- name: Set environment variables
15+
run: |
16+
if [ "${{ matrix.arch }}" = "amd64" ]; then
17+
export ARCH=amd64
18+
elif [ "${{ matrix.arch }}" = "arm64" ]; then
19+
export ARCH=arm64
20+
fi
21+
echo "ARCH=$ARCH" >> $GITHUB_ENV
22+
723
- name: Checkout
824
uses: actions/checkout@v3
925

10-
- name: Guix cache
11-
uses: actions/cache@v3
12-
with:
13-
path: ~/.cache/guix
14-
# use a key that (almost) never matches
15-
key: guix-cache-${{ github.sha }}
16-
restore-keys: |
17-
guix-cache-
18-
# Cannot use a cache for /gnu/store, since restore fails
19-
- name: Install Guix
20-
uses: PromyLOPh/guix-install-action@v1
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
2128

22-
- name: Ensure no locale warning
23-
run: test -z "$(guix --version 2>&1 >/dev/null)"
29+
- name: Build docker
30+
run: docker build -t emacs-ubuntu-docker-image:latest .
2431

25-
- name: build emacs-x
26-
run: bash build.sh
32+
- name: Save docker
33+
run: docker save emacs-ubuntu-docker-image:latest | gzip > emacs-ubuntu-docker-image-${ARCH}.tar.gz
2734

2835
- name: Release
2936
uses: softprops/action-gh-release@v1
3037
if: startsWith(github.ref, 'refs/tags/')
3138
with:
32-
files: emacs-x-*-installer.*
39+
files: emacs-ubuntu-docker-image-*.*

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM ubuntu:24.04
2+
3+
# setup locale
4+
RUN apt update && apt install -y locales && rm -rf /var/lib/apt/lists/* \
5+
&& localedef -i zh_CN -c -f UTF-8 -A /usr/share/locale/locale.alias zh_CN.UTF-8
6+
ENV LANG=zh_CN.utf8
7+
8+
# install deps
9+
RUN apt update && apt install -y \
10+
git build-essential autoconf texinfo pkg-config \
11+
libgnutls28-dev gnutls-bin libncurses-dev libsqlite3-dev libselinux-dev dbus libtree-sitter-dev zlib1g-dev libsystemd-dev emacs-nox
12+
13+
WORKDIR /tmp
14+
# build emacs
15+
RUN git clone --depth 1 https://github.com/emacs-mirror/emacs.git && \
16+
cd emacs && \
17+
sh autogen.sh && \
18+
sh configure --prefix=/usr --with-native-compilation=no --with-x-toolkit=no && \
19+
make -j8 && \
20+
make install
21+
22+
# config emacs
23+
RUN git clone https://github.com/xhcoding/emacs.d.git ~/.emacs.d && \
24+
cd ~/.emacs.d/ && \
25+
emacs -Q --batch -l org --eval "(org-babel-tangle-file \"README.org\")" && \
26+
emacs --batch --load ~/.emacs.d/early-init.el --load ~/.emacs.d/init.el
27+

README.org

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ ref: https://github.com/manateelazycat/auto-save
736736

737737
#+begin_src elisp
738738
(use-package faces
739+
:disabled
739740
:ban minimal?
740741
:custom-face
741742
(variable-pitch
@@ -755,7 +756,7 @@ ref: https://github.com/manateelazycat/auto-save
755756
)
756757

757758

758-
(load-theme 'modus-operandi-tinted :no-confirm)
759+
;;(load-theme 'modus-operandi-tinted :no-confirm)
759760
#+end_src
760761

761762
** ligature 连字体
@@ -1693,6 +1694,19 @@ ref:https://github.com/manateelazycat/toggle-one-window
16931694
(yaml . ("https://github.com/ikatyang/tree-sitter-yaml"))
16941695
(toml . ("https://github.com/tree-sitter/tree-sitter-toml"))
16951696
(zig . ("https://github.com/GrayJack/tree-sitter-zig"))))
1697+
1698+
(defun my-treesit-install-langs (langs)
1699+
""
1700+
(dolist (lang langs)
1701+
(let* ((out-dir (locate-user-emacs-file "tree-sitter"))
1702+
(soext (car dynamic-library-suffixes))
1703+
(lib-name (concat "libtree-sitter-" (symbol-name lang) soext))
1704+
(lib-path (expand-file-name lib-name out-dir)))
1705+
(unless (file-exists-p lib-path)
1706+
(treesit-install-language-grammar lang)))))
1707+
1708+
(unless sys-is-windows
1709+
(my-treesit-install-langs '(bash c cpp cmake dockerfile elisp json python rust yaml)))
16961710
#+end_src
16971711

16981712
** elisp 配置

0 commit comments

Comments
 (0)