diff --git a/Dockerfile b/Dockerfile index e522330..4c7aa35 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +FROM lsiobase/cloud9:files-alpine as c9files FROM lsiobase/nginx:3.10 # set version label @@ -10,7 +11,30 @@ LABEL maintainer="aptalca" # environment settings ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 +# cloud9 +COPY --from=c9files /buildout/ / + RUN \ + echo "**** install dev packages ****" && \ + apk add --no-cache \ + c-ares \ + curl \ + git \ + gnupg \ + http-parser \ + libevent \ + libevent \ + libstdc++ \ + libuv \ + sudo && \ + echo "**** user perms ****" && \ + usermod -aG wheel \ + abc && \ + echo "auth sufficient pam_shells.so" > /etc/pam.d/chsh && \ + chsh abc -s /bin/bash && \ + sed -e \ + 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' \ + -i /etc/sudoers && \ echo "**** install runtime packages ****" && \ apk add --no-cache \ curl \ @@ -21,14 +45,27 @@ RUN \ tar && \ echo "**** install heimdall ****" && \ mkdir -p \ - /heimdall && \ - if [ -z ${HEIMDALL_RELEASE+x} ]; then \ - HEIMDALL_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/commits/master" \ - | awk '/sha/{print $4;exit}' FS='[""]'); \ - fi && \ - curl -o \ - /heimdall/heimdall.tar.gz -L \ - "https://github.com/linuxserver/Heimdall/archive/${HEIMDALL_RELEASE}.tar.gz" && \ + /c9sdk/build/standalone \ + /var/www/localhost/heimdall && \ + git clone \ + https://github.com/linuxserver/Heimdall.git \ + /var/www/localhost/heimdall && \ + echo "**** dev setup and permissions ****" && \ + echo -e \ + '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ + /etc/nginx/fastcgi_params && \ + cp \ + /var/www/localhost/heimdall/.env.example \ + /var/www/localhost/heimdall/.env && \ + php /var/www/localhost/heimdall/artisan key:generate && \ + sed -i \ + 's/QUEUE_DRIVER=sync/QUEUE_DRIVER=database/' \ + /var/www/localhost/heimdall/.env && \ + chown -R abc:abc \ + /c9sdk/build/standalone \ + /c9bins \ + /config \ + /var/www/localhost/heimdall && \ echo "**** cleanup ****" && \ rm -rf \ /tmp/* diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 395f7de..d3a7813 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,3 +1,4 @@ +FROM lsiobase/cloud9:arm64v8-files-alpine as c9files FROM lsiobase/nginx:arm64v8-3.10 # set version label @@ -10,7 +11,30 @@ LABEL maintainer="aptalca" # environment settings ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 +# cloud9 +COPY --from=c9files /buildout/ / + RUN \ + echo "**** install dev packages ****" && \ + apk add --no-cache \ + c-ares \ + curl \ + git \ + gnupg \ + http-parser \ + libevent \ + libevent \ + libstdc++ \ + libuv \ + sudo && \ + echo "**** user perms ****" && \ + usermod -aG wheel \ + abc && \ + echo "auth sufficient pam_shells.so" > /etc/pam.d/chsh && \ + chsh abc -s /bin/bash && \ + sed -e \ + 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' \ + -i /etc/sudoers && \ echo "**** install runtime packages ****" && \ apk add --no-cache \ curl \ @@ -21,14 +45,27 @@ RUN \ tar && \ echo "**** install heimdall ****" && \ mkdir -p \ - /heimdall && \ - if [ -z ${HEIMDALL_RELEASE+x} ]; then \ - HEIMDALL_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/commits/master" \ - | awk '/sha/{print $4;exit}' FS='[""]'); \ - fi && \ - curl -o \ - /heimdall/heimdall.tar.gz -L \ - "https://github.com/linuxserver/Heimdall/archive/${HEIMDALL_RELEASE}.tar.gz" && \ + /c9sdk/build/standalone \ + /var/www/localhost/heimdall && \ + git clone \ + https://github.com/linuxserver/Heimdall.git \ + /var/www/localhost/heimdall && \ + echo "**** dev setup and permissions ****" && \ + echo -e \ + '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ + /etc/nginx/fastcgi_params && \ + cp \ + /var/www/localhost/heimdall/.env.example \ + /var/www/localhost/heimdall/.env && \ + php /var/www/localhost/heimdall/artisan key:generate && \ + sed -i \ + 's/QUEUE_DRIVER=sync/QUEUE_DRIVER=database/' \ + /var/www/localhost/heimdall/.env && \ + chown -R abc:abc \ + /c9sdk/build/standalone \ + /c9bins \ + /config \ + /var/www/localhost/heimdall && \ echo "**** cleanup ****" && \ rm -rf \ /tmp/* diff --git a/Dockerfile.armhf b/Dockerfile.armhf index ffbc714..8e3a43b 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,3 +1,4 @@ +FROM lsiobase/cloud9:arm32v7-files-alpine as c9files FROM lsiobase/nginx:arm32v7-3.10 # set version label @@ -10,7 +11,30 @@ LABEL maintainer="aptalca" # environment settings ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2 +# cloud9 +COPY --from=c9files /buildout/ / + RUN \ + echo "**** install dev packages ****" && \ + apk add --no-cache \ + c-ares \ + curl \ + git \ + gnupg \ + http-parser \ + libevent \ + libevent \ + libstdc++ \ + libuv \ + sudo && \ + echo "**** user perms ****" && \ + usermod -aG wheel \ + abc && \ + echo "auth sufficient pam_shells.so" > /etc/pam.d/chsh && \ + chsh abc -s /bin/bash && \ + sed -e \ + 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' \ + -i /etc/sudoers && \ echo "**** install runtime packages ****" && \ apk add --no-cache \ curl \ @@ -21,14 +45,27 @@ RUN \ tar && \ echo "**** install heimdall ****" && \ mkdir -p \ - /heimdall && \ - if [ -z ${HEIMDALL_RELEASE+x} ]; then \ - HEIMDALL_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/commits/master" \ - | awk '/sha/{print $4;exit}' FS='[""]'); \ - fi && \ - curl -o \ - /heimdall/heimdall.tar.gz -L \ - "https://github.com/linuxserver/Heimdall/archive/${HEIMDALL_RELEASE}.tar.gz" && \ + /c9sdk/build/standalone \ + /var/www/localhost/heimdall && \ + git clone \ + https://github.com/linuxserver/Heimdall.git \ + /var/www/localhost/heimdall && \ + echo "**** dev setup and permissions ****" && \ + echo -e \ + '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ + /etc/nginx/fastcgi_params && \ + cp \ + /var/www/localhost/heimdall/.env.example \ + /var/www/localhost/heimdall/.env && \ + php /var/www/localhost/heimdall/artisan key:generate && \ + sed -i \ + 's/QUEUE_DRIVER=sync/QUEUE_DRIVER=database/' \ + /var/www/localhost/heimdall/.env && \ + chown -R abc:abc \ + /c9sdk/build/standalone \ + /c9bins \ + /config \ + /var/www/localhost/heimdall && \ echo "**** cleanup ****" && \ rm -rf \ /tmp/* diff --git a/README.md b/README.md index 36b5d3e..a8a9fa0 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **26.07.19:** - Modify development branch to include integrated IDE. * **15.07.19:** - Save laravel.log to /config, install heimdall during first start. * **28.06.19:** - Rebasing to alpine 3.10. * **23.03.19:** - Switching to new Base images, shift to arm32v7 tag. diff --git a/readme-vars.yml b/readme-vars.yml index a091791..ced8773 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -52,6 +52,7 @@ app_setup_block: | # changelog changelogs: + - { date: "26.07.19:", desc: "Modify development branch to include integrated IDE." } - { date: "15.07.19:", desc: "Save laravel.log to /config, install heimdall during first start." } - { date: "28.06.19:", desc: "Rebasing to alpine 3.10." } - { date: "23.03.19:", desc: "Switching to new Base images, shift to arm32v7 tag." } diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config deleted file mode 100644 index 2b42b61..0000000 --- a/root/etc/cont-init.d/50-config +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/with-contenv bash - -# make our folders -mkdir -p \ - /config/www/{backgrounds,icons,avatars,SupportedApps} \ - /var/www/localhost/heimdall \ - /config/log/heimdall - -# install heimdall if necessary -[[ -f /heimdall/heimdall.tar.gz ]] && \ - echo "New container detected, installing Heimdall" && \ - tar xf \ - /heimdall/heimdall.tar.gz -C \ - /var/www/localhost/heimdall --strip-components=1 && \ - echo -e '\n# Heimdall user authorization\nfastcgi_param PHP_AUTH_USER $remote_user;\nfastcgi_param PHP_AUTH_PW $http_authorization;' >> \ - /etc/nginx/fastcgi_params && \ - rm -rf /heimdall && \ - chown -R abc:abc /var/www/localhost/heimdall - -# create symlinks - -symlinks=( \ -/var/www/localhost/heimdall/storage/app/public/avatars \ -/var/www/localhost/heimdall/storage/app/public/backgrounds \ -/var/www/localhost/heimdall/storage/app/public/icons \ -/var/www/localhost/heimdall/app/SupportedApps \ -/var/www/localhost/heimdall/database/app.sqlite \ -/var/www/localhost/heimdall/.env ) - -for i in "${symlinks[@]}" -do -[[ -e "$i" && ! -L "$i" ]] && rm -rf "$i" -[[ ! -L "$i" ]] && ln -s /config/www/"$(basename "$i")" "$i" -done - -[[ -e "/var/www/localhost/heimdall/storage/logs/laravel.log" && ! -L "/var/www/localhost/heimdall/storage/logs/laravel.log" ]] \ - && rm -rf "/var/www/localhost/heimdall/storage/logs/laravel.log" -[[ ! -L "/var/www/localhost/heimdall/storage/logs/laravel.log" ]] && \ - ln -s "/config/log/heimdall/laravel.log" "/var/www/localhost/heimdall/storage/logs/laravel.log" - -# copy .env if not exists -[[ ! -f /config/www/.env ]] && \ - cp /var/www/localhost/heimdall/.env.example /config/www/.env && \ - echo "generating app key" - php /var/www/localhost/heimdall/artisan key:generate -# set queue driver to database -sed -i 's/QUEUE_DRIVER=sync/QUEUE_DRIVER=database/' /config/www/.env - -# permissions -chown -R abc:abc \ - /config \ - /var/www/localhost/heimdall diff --git a/root/etc/logrotate.d/heimdall b/root/etc/logrotate.d/heimdall deleted file mode 100644 index f777e6b..0000000 --- a/root/etc/logrotate.d/heimdall +++ /dev/null @@ -1,9 +0,0 @@ -/config/log/heimdall/laravel.log { - size 5M - rotate 5 - compress - nodateext - notifempty - missingok - su abc abc -} \ No newline at end of file diff --git a/root/etc/services.d/cloud9/run b/root/etc/services.d/cloud9/run new file mode 100644 index 0000000..47863d1 --- /dev/null +++ b/root/etc/services.d/cloud9/run @@ -0,0 +1,6 @@ +#!/usr/bin/with-contenv bash + +cd /c9sdk +HOME=/c9bins exec \ + s6-setuidgid abc \ + /c9bins/.c9/node/bin/node server.js --listen 0.0.0.0 -p 8000 -w /var/www/localhost/heimdall -a :