Alpine Linux notes
The second best Linux distribution.
Published: Mar 17, 2025

General

Run an Alpine Linux instance with Docker

Great for testing purposes. Original reference.

1docker run -it --rm alpine /bin/ash

Running PixivFE as an OpenRC service

In this section, we’ll get PixivFE running as an OpenRC service on an Alpine Linux Docker image.

The stock Alpine image does not ship with OpenRC, so in order to create and run OpenRC services in our Alpine instance, we’ll need a workaround:

1docker run -it -v /sys/fs/cgroup -p 8282:8282 --rm alpine /bin/ash

You should be greeted with an interactive ash shell. Welcome to Alpine Linux! Now, copy the following code block below and execute it:

 1cd ~
 2
 3# Install basic dependencies
 4apk add --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing \
 5      git curl go openrc micro
 6
 7# Clone and build PixivFE
 8git clone --depth 1 https://codeberg.org/PixivFE/PixivFE/ \
 9    -b v2                  ## Clone a specific remote branch (e.g: tailwind-rewrite)
10cd PixivFE/
11
12## Get TailwindCSS
13curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/download/v4.0.14/tailwindcss-linux-x64-musl
14chmod +x ./tailwindcss-linux-x64-musl
15./tailwindcss-linux-x64-musl -i assets/css/tailwind-style_source.css -o assets/css/tailwind-style.css
16./build.sh
17
18mv ./pixivfe /usr/local/bin/
19
20# PixivFE config file (put your own configs here)
21mkdir /etc/pixivfe
22echo 'token:
23- 123456_arstdhnei' > /etc/pixivfe/config.yml
24
25# Setup init script
26echo '#!/sbin/openrc-run
27
28name="pixivfe"
29command="/usr/local/bin/pixivfe"                  # Path to directory
30command_args="-config /etc/pixivfe/config.yml"
31directory="/root/PixivFE"                         # Path to PixivFEs source code (yes, it is needed)
32command_background=yes
33pidfile="/run/$name.pid"
34error_log="/var/log/$name.err"
35
36depend() {
37        need net
38        after firewall
39}' > /etc/init.d/pixivfe
40
41chmod a+x /etc/init.d/pixivfe
42
43# Running the service
44# https://stackoverflow.com/questions/77188345/alpine-docker-hostname-service-wont-start-sethostname-operation-not-permitte
45echo 'rc_need="!dev !net"' >> /etc/rc.conf
46openrc
47touch /run/openrc/softlevel
48rc-service pixivfe restart
49
50# Profit!
51curl -sI localhost:8282 | grep -i "X-Powered-By"
52# X-Powered-By: hatsune miku

Thanks to the -p 8282:8282 argument we passed into our Docker command earlier, you can access PixivFE directly on your host machine.

Alpine Package Keeper (apk)

Specify a repository to fetch packages from

Edit /etc/apk/repositories to change repositories permanently.

1apk add <package-name> --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing/

← Go to parent