Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard base #52

Merged
merged 7 commits into from Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 10 additions & 11 deletions Dockerfile
@@ -1,4 +1,4 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.14-php8
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15

# set version label
ARG BUILD_DATE
Expand All @@ -10,6 +10,7 @@ LABEL maintainer="alex-phillips, homerr"
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
composer \
git \
yarn && \
echo "**** install runtime packages ****" && \
Expand All @@ -27,11 +28,8 @@ RUN \
php8-phar \
php8-tokenizer \
php8-zip && \
echo "**** install composer ****" && \
php8 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php8 composer-setup.php --install-dir=/tmp --filename=composer && \
echo "**** install grocy ****" && \
mkdir -p /app/grocy && \
mkdir -p /app/www && \
if [ -z ${GROCY_RELEASE+x} ]; then \
GROCY_RELEASE=$(curl -sX GET "https://api.github.com/repos/grocy/grocy/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
Expand All @@ -41,26 +39,27 @@ RUN \
"https://github.com/grocy/grocy/archive/${GROCY_RELEASE}.tar.gz" && \
tar xf \
/tmp/grocy.tar.gz -C \
/app/grocy/ --strip-components=1 && \
cp -R /app/grocy/data/plugins \
/app/www/ --strip-components=1 && \
cp -R /app/www/data/plugins \
/defaults/plugins && \
echo "**** install composer packages ****" && \
php8 /tmp/composer install -d /app/grocy --no-dev && \
composer install -d /app/www --no-dev && \
echo "**** install yarn packages ****" && \
cd /app/grocy && \
cd /app/www && \
yarn --production && \
yarn cache clean && \
mv /app/grocy/public/node_modules /defaults/node_modules && \
mv /app/www/public/node_modules /defaults/node_modules && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/root/.composer \
/root/.cache \
/tmp/*

# copy local files
COPY root/ /

# ports and volumes
EXPOSE 80
EXPOSE 80 443
VOLUME /config
21 changes: 10 additions & 11 deletions Dockerfile.aarch64
@@ -1,4 +1,4 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.14-php8
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15

# set version label
ARG BUILD_DATE
Expand All @@ -10,6 +10,7 @@ LABEL maintainer="alex-phillips, homerr"
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
composer \
git \
yarn && \
echo "**** install runtime packages ****" && \
Expand All @@ -27,11 +28,8 @@ RUN \
php8-phar \
php8-tokenizer \
php8-zip && \
echo "**** install composer ****" && \
php8 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php8 composer-setup.php --install-dir=/tmp --filename=composer && \
echo "**** install grocy ****" && \
mkdir -p /app/grocy && \
mkdir -p /app/www && \
if [ -z ${GROCY_RELEASE+x} ]; then \
GROCY_RELEASE=$(curl -sX GET "https://api.github.com/repos/grocy/grocy/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
Expand All @@ -41,26 +39,27 @@ RUN \
"https://github.com/grocy/grocy/archive/${GROCY_RELEASE}.tar.gz" && \
tar xf \
/tmp/grocy.tar.gz -C \
/app/grocy/ --strip-components=1 && \
cp -R /app/grocy/data/plugins \
/app/www/ --strip-components=1 && \
cp -R /app/www/data/plugins \
/defaults/plugins && \
echo "**** install composer packages ****" && \
php8 /tmp/composer install -d /app/grocy --no-dev && \
composer install -d /app/www --no-dev && \
echo "**** install yarn packages ****" && \
cd /app/grocy && \
cd /app/www && \
yarn --production && \
yarn cache clean && \
mv /app/grocy/public/node_modules /defaults/node_modules && \
mv /app/www/public/node_modules /defaults/node_modules && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/root/.composer \
/root/.cache \
/tmp/*

# copy local files
COPY root/ /

# ports and volumes
EXPOSE 80
EXPOSE 80 443
VOLUME /config
21 changes: 10 additions & 11 deletions Dockerfile.armhf
@@ -1,4 +1,4 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.14-php8
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15

# set version label
ARG BUILD_DATE
Expand All @@ -10,6 +10,7 @@ LABEL maintainer="alex-phillips, homerr"
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
composer \
git \
yarn && \
echo "**** install runtime packages ****" && \
Expand All @@ -27,11 +28,8 @@ RUN \
php8-phar \
php8-tokenizer \
php8-zip && \
echo "**** install composer ****" && \
php8 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php8 composer-setup.php --install-dir=/tmp --filename=composer && \
echo "**** install grocy ****" && \
mkdir -p /app/grocy && \
mkdir -p /app/www && \
if [ -z ${GROCY_RELEASE+x} ]; then \
GROCY_RELEASE=$(curl -sX GET "https://api.github.com/repos/grocy/grocy/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
Expand All @@ -41,26 +39,27 @@ RUN \
"https://github.com/grocy/grocy/archive/${GROCY_RELEASE}.tar.gz" && \
tar xf \
/tmp/grocy.tar.gz -C \
/app/grocy/ --strip-components=1 && \
cp -R /app/grocy/data/plugins \
/app/www/ --strip-components=1 && \
cp -R /app/www/data/plugins \
/defaults/plugins && \
echo "**** install composer packages ****" && \
php8 /tmp/composer install -d /app/grocy --no-dev && \
composer install -d /app/www --no-dev && \
echo "**** install yarn packages ****" && \
cd /app/grocy && \
cd /app/www && \
yarn --production && \
yarn cache clean && \
mv /app/grocy/public/node_modules /defaults/node_modules && \
mv /app/www/public/node_modules /defaults/node_modules && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/root/.composer \
/root/.cache \
/tmp/*

# copy local files
COPY root/ /

# ports and volumes
EXPOSE 80
EXPOSE 80 443
VOLUME /config
2 changes: 1 addition & 1 deletion Jenkinsfile
Expand Up @@ -720,7 +720,7 @@ pipeline {
-e DO_REGION="ams3" \
-e DO_BUCKET="lsio-ci" \
-t ghcr.io/linuxserver/ci:latest \
python /ci/ci.py'''
python3 test_build.py'''
}
}
}
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -226,6 +226,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64

## Versions

* **20.08.22:** - Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base)).
* **22.08.21:** - Rebase to Alpine 3.14 and PHP 8.
* **25.07.21:** - Add 'int','json' and 'zlib' PHP extensions.
* **10.05.21:** - Reduce image size.
Expand Down
1 change: 1 addition & 0 deletions readme-vars.yml
Expand Up @@ -39,6 +39,7 @@ app_setup_block: |

# changelog
changelogs:
- { date: "20.08.22:", desc: "Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base))." }
- { date: "22.08.21:", desc: "Rebase to Alpine 3.14 and PHP 8." }
- { date: "25.07.21:", desc: "Add 'int','json' and 'zlib' PHP extensions." }
- { date: "10.05.21:", desc: "Reduce image size." }
Expand Down
40 changes: 40 additions & 0 deletions root/app/grocy/public/index.html
@@ -0,0 +1,40 @@
<html>
<head>
<title>Upgrade Required!</title>
<style>
body{
font-family: Helvetica, Arial, sans-serif;
}
.message{
width:440px;
padding:20px 40px;
margin:0 auto;
background-color:#f9f9f9;
border:1px solid #ddd;
color: #1e3d62;
}
center{
margin:40px 0;
}
h1{
font-size: 18px;
line-height: 26px;
}
p{
font-size: 12px;
}
a{
color: rgb(207, 48, 139);
}
</style>
</head>
<body>
<div class="message">
<h1>Upgrade Required!</h1>
<p>The application inside this image has been moved to a new folder.</p>
<p>You will need to update your <strong>/config/nginx/nginx.conf</strong> and <strong>/config/nginx/site-confs/default.conf</strong> in order for the application to work.</p>
<p>New config samples are located at <strong>/config/nginx/nginx.conf.sample</strong> and <strong>/config/nginx/site-confs/default.conf.sample</strong></p>
<p>Please review our announcement: <a target="_blank" href="https://info.linuxserver.io/issues/2022-08-20-nginx-base/">Significant changes to nginx based images</a></p>
</div>
</body>
</html>
23 changes: 0 additions & 23 deletions root/defaults/default

This file was deleted.

27 changes: 0 additions & 27 deletions root/defaults/nginx.conf

This file was deleted.

34 changes: 34 additions & 0 deletions root/defaults/nginx/site-confs/default.conf.sample
@@ -0,0 +1,34 @@
## Version 2022/08/20 - Changelog: https://github.com/linuxserver/docker-grocy/commits/master/root/defaults/nginx/site-confs/default.conf.sample

server {
listen 80 default_server;
listen [::]:80 default_server;

listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;

server_name _;

root /app/www/public;
index index.html index.htm index.php;

location / {
# enable for basic auth
#auth_basic "Restricted";
#auth_basic_user_file /config/nginx/.htpasswd;

try_files $uri $uri/ /index.php$is_args$args;
}

location ~ ^(.+\.php)(.*)$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}

# deny access to .htaccess/.htpasswd files
location ~ /\.ht {
deny all;
}
}
29 changes: 17 additions & 12 deletions root/etc/cont-init.d/50-config
@@ -1,27 +1,32 @@
#!/usr/bin/with-contenv bash

# create missing cache directory
mkdir -p /app/grocy/data/viewcache || :
mkdir -p /app/www/data/viewcache || :

# create symlinks
i=/app/grocy/data
[[ -e "$i" && ! -L "$i" && -e /config/"$(basename "$i")" ]] && \
rm -Rf "$i" && \
i=/app/www/data
if [[ -e "$i" && ! -L "$i" && -e /config/"$(basename "$i")" ]]; then
rm -Rf "$i"
ln -s /config/"$(basename "$i")" "$i"
[[ -e "$i" && ! -L "$i" ]] && \
mv "$i" /config/"$(basename "$i")" && \
fi
if [[ -e "$i" && ! -L "$i" ]]; then
mv "$i" /config/"$(basename "$i")"
ln -s /config/"$(basename "$i")" "$i"
fi

[[ -d /defaults/node_modules ]] && \
mv /defaults/node_modules /app/grocy/public/node_modules
if [[ -d /defaults/node_modules ]]; then
mv /defaults/node_modules /app/www/public/node_modules
fi

# check for config file and copy default if needed
[[ ! -f "/config/data/config.php" ]] && \
cp /app/grocy/config-dist.php /config/data/config.php
if [[ ! -f "/config/data/config.php" ]]; then
cp /app/www/config-dist.php /config/data/config.php
fi

[[ ! -f "/config/data/plugins/DemoBarcodeLookupPlugin.php" ]] && \
if [[ ! -f "/config/data/plugins/DemoBarcodeLookupPlugin.php" ]]; then
cp -R /defaults/plugins /config/data
fi

chown -R abc:abc \
/app/grocy \
/app/www \
/config
10 changes: 10 additions & 0 deletions root/migrations/02-default-location
@@ -0,0 +1,10 @@
#!/usr/bin/with-contenv bash

DEFAULT_CONF="/config/nginx/site-confs/default.conf"
OLD_ROOT="root /app/grocy/public;"
NEW_ROOT="root /app/www/public;"

if grep -q "${OLD_ROOT}" "${DEFAULT_CONF}";then
echo "updating root in ${DEFAULT_CONF}"
sed -i "s|${OLD_ROOT}|${NEW_ROOT}|" "${DEFAULT_CONF}"
fi