Skip to content

Commit

Permalink
(#626) Use alpine 3.12 for windows builds ¯\_(ツ)_/¯
Browse files Browse the repository at this point in the history
  • Loading branch information
Difegue committed Jun 16, 2022
1 parent b811f76 commit 4b8dbb1
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 3 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 @@ -43,7 +43,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-legacy .
docker create --name rootfs difegue/lanraragi
docker export --output=package.tar rootfs
- name: Upload rootfs
Expand Down
73 changes: 73 additions & 0 deletions tools/build/docker/Dockerfile-legacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# DOCKER-VERSION 0.3.4
FROM alpine:3.12.12
LABEL git="https://github.com/Difegue/LANraragi"

ENV S6_KEEP_ENV 1

# warn if we can't run stage2 (fix-attrs/cont-init)
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 1

# wait 10s before KILLing
ENV S6_KILL_GRACETIME 10000

# s6
ENTRYPOINT ["/init"]

# Check application health
HEALTHCHECK --interval=1m --timeout=10s --retries=3 \
CMD wget --quiet --tries=1 --no-check-certificate --spider \
http://localhost:3000 || exit 1

#Default mojo server port
EXPOSE 3000

# Enable UTF-8 (might not do anything extra on alpine tho)
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 \
# rootless user id
LRR_UID=9001 LRR_GID=9001 \
# Environment variables overridable by the user on container deployment
LRR_NETWORK=http://*:3000 \
# extra variables
EV_EXTRA_DEFS=-DEV_NO_ATFORK \
# Enable automatic http proxy detection for mojo
MOJO_PROXY=1

RUN \
if [ $(getent group ${LRR_GID}) ]; then \
adduser -D -u ${LRR_UID} koyomi; \
else \
addgroup -g ${LRR_GID} koyomi && \
adduser -D -u ${LRR_UID} -G koyomi koyomi; \
fi

# we use s6-overlay-nobin to just pull in the s6-overlay arch agnostic (shell)
# components, since we apk install the binaries of s6 later which are arch specific
ADD https://github.com/just-containers/s6-overlay/releases/download/v2.0.0.1/s6-overlay-nobin.tar.gz /tmp/s6-overlay-nobin.tar.gz
RUN tar -C / -xzf /tmp/s6-overlay-nobin.tar.gz && rm -f /tmp/s6-overlay-nobin.tar.gz

WORKDIR /home/koyomi/lanraragi

#Copy cpanfile and install script before copying the entire context
#This allows for Docker cache to preserve cpan dependencies
COPY --chown=koyomi:koyomi /tools/cpanfile /tools/install.pl /tools/build/docker/install-everything.sh tools/
COPY --chown=koyomi:koyomi /package.json package.json

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

#Copy remaining LRR files from context
COPY --chown=koyomi:koyomi /lib lib
COPY --chown=koyomi:koyomi /public public
COPY --chown=koyomi:koyomi /script script
COPY --chown=koyomi:koyomi /templates templates
COPY --chown=koyomi:koyomi /tests tests
COPY --chown=koyomi:koyomi /lrr.conf lrr.conf
COPY --chown=koyomi:koyomi /tools/build/docker/redis.conf tools/build/docker/
COPY /tools/build/docker/wsl.conf /etc/wsl.conf
COPY /tools/build/docker/s6/cont-init.d/ /etc/cont-init.d/
COPY /tools/build/docker/s6/services.d/ /etc/services.d/
#COPY /tools/build/docker/s6/fix-attrs.d/ /etc/fix-attrs.d/

# Persistent volumes
VOLUME [ "/home/koyomi/lanraragi/content" ]
VOLUME [ "/home/koyomi/lanraragi/database"]
14 changes: 12 additions & 2 deletions tools/build/docker/install-everything.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@
apk update
apk add perl perl-io-socket-ssl perl-dev redis libarchive-dev libbz2 openssl-dev zlib-dev
apk add imagemagick imagemagick-perlmagick libwebp-tools libheif
apk add g++ make pkgconf gnupg wget curl nodejs npm file
apk add shadow s6 s6-portable-utils s6-overlay s6-overlay-preinit
apk add g++ make pkgconf gnupg wget curl file
apk add shadow s6 s6-portable-utils

# Check for alpine version
if [ -f /etc/alpine-release ]; then
alpine_version=$(cat /etc/alpine-release)
if [ "$alpine_version" = "3.12.12" ]; then
apk add nodejs-npm
else # Those packages don't exist on 3.12
apk add nodejs npm s6-overlay s6-overlay-preinit
fi
fi

#Hey it's cpanm
curl -L https://cpanmin.us | perl - App::cpanminus
Expand Down

0 comments on commit 4b8dbb1

Please sign in to comment.