Skip to content

Commit

Permalink
(#805) Use an installer option instead of looking at the alpine build…
Browse files Browse the repository at this point in the history
… number for wsl-specific stuff
  • Loading branch information
Difegue committed May 17, 2023
1 parent 973e941 commit 8fdf717
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push-continous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- uses: actions/checkout@master
- name: Docker Build and export
run: |
docker build -t difegue/lanraragi -f ./tools/build/docker/Dockerfile .
docker build -t difegue/lanraragi -f ./tools/build/docker/Dockerfile --build-arg INSTALL_PARAMETER=-win .
docker create --name rootfs difegue/lanraragi
docker export --output=package.tar rootfs
- name: Upload rootfs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@master
- name: Docker Build and export
run: |
docker build -t difegue/lanraragi -f ./tools/build/docker/Dockerfile .
docker build -t difegue/lanraragi -f ./tools/build/docker/Dockerfile --build-arg INSTALL_PARAMETER=-win .
docker create --name rootfs difegue/lanraragi
docker export --output=package.tar rootfs
- name: Upload rootfs
Expand Down
3 changes: 2 additions & 1 deletion tools/build/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# DOCKER-VERSION 0.3.4
FROM alpine:3.18
LABEL git="https://github.com/Difegue/LANraragi"
ARG INSTALL_PARAMETER

ENV S6_KEEP_ENV 1

Expand Down Expand Up @@ -52,7 +53,7 @@ COPY --chown=koyomi:koyomi /tools/cpanfile /tools/install.pl /tools/build/docker
COPY --chown=koyomi:koyomi /package.json package.json

# Run the install script as root
RUN sh ./tools/install-everything.sh
RUN sh ./tools/install-everything.sh $INSTALL_PARAMETER

#Copy remaining LRR files from context
COPY --chown=koyomi:koyomi /lib lib
Expand Down
2 changes: 1 addition & 1 deletion tools/build/docker/Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# DOCKER-VERSION 0.3.4
FROM alpine:3.16
FROM alpine:3.18

#Default mojo server port
EXPOSE 3000
Expand Down
28 changes: 13 additions & 15 deletions tools/build/docker/install-everything.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
#!/bin/sh

usage() { echo "Usage: $0 [-d]" 1>&2; exit 1; }
usage() { echo "Usage: $0 [-d -win]" 1>&2; exit 1; }

DEV=0
WSL=0

while getopts "d" o; do
case "${o}" in
d)
DEV=1
;;
win)
WSL=1
;;
*)
usage
;;
Expand All @@ -22,25 +26,19 @@ apk add perl perl-io-socket-ssl perl-dev redis libarchive-dev libbz2 openssl-dev
apk add imagemagick imagemagick-perlmagick libwebp-tools libheif
apk add g++ make pkgconf gnupg wget curl file
apk add shadow s6 s6-portable-utils
apk add nodejs npm s6-overlay libjxl

# Install cpanm
curl -L https://cpanmin.us | perl - App::cpanminus

# Check for alpine version - 3.12 is used for the WSL version.
if [ -f /etc/alpine-release ]; then
alpine_version=$(cat /etc/alpine-release)
if [ "$alpine_version" = "3.12.12" ]; then
apk add nodejs-npm

# Install Linux::Inotify 2.2 explicitly as 2.3 doesn't work properly on WSL:
# WSL2 literally doesn't work for any form of filewatching,
# WSL1 works with both default watcher and inotify 2.2, but crashes with inotify 2.3 ("can't open fd 4 as perl handle")
# Check for windows to install specific versions of packages
if [ $WSL -eq 1 ]; then
# Install Linux::Inotify 2.2 explicitly as 2.3 doesn't work properly on WSL:
# WSL2 literally doesn't work for any form of filewatching,
# WSL1 works with both default watcher and inotify 2.2, but crashes with inotify 2.3 ("can't open fd 4 as perl handle")

# Doing the install here allows us to use 2.3 on non-WSL builds.
cpanm https://cpan.metacpan.org/authors/id/M/ML/MLEHMANN/Linux-Inotify2-2.2.tar.gz --reinstall
else # Those packages don't exist on 3.12
apk add nodejs npm s6-overlay libjxl
fi
# Doing the install here allows us to use 2.3 on non-WSL builds.
cpanm https://cpan.metacpan.org/authors/id/M/ML/MLEHMANN/Linux-Inotify2-2.2.tar.gz --reinstall
fi

#Alpine's libffi build comes with AVX instructions enabled
Expand Down

0 comments on commit 8fdf717

Please sign in to comment.