Skip to content

Commit

Permalink
Rebase to 3.17, migrate to s6v3, fix envs
Browse files Browse the repository at this point in the history
  • Loading branch information
thespad committed Dec 28, 2022
1 parent f76a337 commit 6d7feb6
Show file tree
Hide file tree
Showing 16 changed files with 124 additions and 104 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/call_invalid_helper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Comment on invalid interaction
on:
issues:
types:
- labeled
jobs:
add-comment-on-invalid:
if: github.event.label.name == 'invalid'
permissions:
issues: write
uses: linuxserver/github-workflows/.github/workflows/invalid-interaction-helper.yml@v1
secrets: inherit
50 changes: 25 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15
# syntax=docker/dockerfile:1

FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.17

# set version label
ARG BUILD_DATE
Expand All @@ -13,32 +15,30 @@ RUN \
composer && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
curl \
libxml2 \
mariadb-client \
php8-bcmath \
php8-ctype \
php8-curl \
php8-gd \
php8-iconv \
php8-ldap \
php8-mbstring \
php8-pdo_mysql \
php8-pdo_sqlite \
php8-pecl-mcrypt \
php8-phar \
php8-sodium \
php8-sqlite3 \
php8-tokenizer \
php8-xml \
php8-xmlreader \
php8-zip \
tar \
unzip && \
php81-bcmath \
php81-ctype \
php81-curl \
php81-gd \
php81-iconv \
php81-ldap \
php81-mbstring \
php81-pdo_mysql \
php81-pdo_sqlite \
php81-phar \
php81-sodium \
php81-sqlite3 \
php81-tokenizer \
php81-xml \
php81-xmlreader \
php81-zip && \
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \
php81-pecl-mcrypt && \
echo "**** configure php-fpm to pass env vars ****" && \
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php8/php-fpm.d/www.conf && \
grep -qxF 'clear_env = no' /etc/php8/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php8/php-fpm.d/www.conf && \
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php8/php-fpm.conf && \
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php81/php-fpm.d/www.conf && \
grep -qxF 'clear_env = no' /etc/php81/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php81/php-fpm.d/www.conf && \
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php81/php-fpm.conf && \
echo "**** install snipe-it ****" && \
mkdir -p \
/app/www/ && \
Expand All @@ -63,7 +63,7 @@ RUN \
apk del --purge \
build-dependencies && \
rm -rf \
/root/.composer \
$HOME/.composer \
/tmp/*

# copy local files
Expand Down
50 changes: 25 additions & 25 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15
# syntax=docker/dockerfile:1

FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.17

# set version label
ARG BUILD_DATE
Expand All @@ -13,32 +15,30 @@ RUN \
composer && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
curl \
libxml2 \
mariadb-client \
php8-bcmath \
php8-ctype \
php8-curl \
php8-gd \
php8-iconv \
php8-ldap \
php8-mbstring \
php8-pdo_mysql \
php8-pdo_sqlite \
php8-pecl-mcrypt \
php8-phar \
php8-sodium \
php8-sqlite3 \
php8-tokenizer \
php8-xml \
php8-xmlreader \
php8-zip \
tar \
unzip && \
php81-bcmath \
php81-ctype \
php81-curl \
php81-gd \
php81-iconv \
php81-ldap \
php81-mbstring \
php81-pdo_mysql \
php81-pdo_sqlite \
php81-phar \
php81-sodium \
php81-sqlite3 \
php81-tokenizer \
php81-xml \
php81-xmlreader \
php81-zip && \
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \
php81-pecl-mcrypt && \
echo "**** configure php-fpm to pass env vars ****" && \
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php8/php-fpm.d/www.conf && \
grep -qxF 'clear_env = no' /etc/php8/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php8/php-fpm.d/www.conf && \
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php8/php-fpm.conf && \
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php81/php-fpm.d/www.conf && \
grep -qxF 'clear_env = no' /etc/php81/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php81/php-fpm.d/www.conf && \
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php81/php-fpm.conf && \
echo "**** install snipe-it ****" && \
mkdir -p \
/app/www/ && \
Expand All @@ -63,7 +63,7 @@ RUN \
apk del --purge \
build-dependencies && \
rm -rf \
/root/.composer \
$HOME/.composer \
/tmp/*

# copy local files
Expand Down
50 changes: 25 additions & 25 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15
# syntax=docker/dockerfile:1

FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.17

# set version label
ARG BUILD_DATE
Expand All @@ -13,32 +15,30 @@ RUN \
composer && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
curl \
libxml2 \
mariadb-client \
php8-bcmath \
php8-ctype \
php8-curl \
php8-gd \
php8-iconv \
php8-ldap \
php8-mbstring \
php8-pdo_mysql \
php8-pdo_sqlite \
php8-pecl-mcrypt \
php8-phar \
php8-sodium \
php8-sqlite3 \
php8-tokenizer \
php8-xml \
php8-xmlreader \
php8-zip \
tar \
unzip && \
php81-bcmath \
php81-ctype \
php81-curl \
php81-gd \
php81-iconv \
php81-ldap \
php81-mbstring \
php81-pdo_mysql \
php81-pdo_sqlite \
php81-phar \
php81-sodium \
php81-sqlite3 \
php81-tokenizer \
php81-xml \
php81-xmlreader \
php81-zip && \
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \
php81-pecl-mcrypt && \
echo "**** configure php-fpm to pass env vars ****" && \
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php8/php-fpm.d/www.conf && \
grep -qxF 'clear_env = no' /etc/php8/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php8/php-fpm.d/www.conf && \
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php8/php-fpm.conf && \
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php81/php-fpm.d/www.conf && \
grep -qxF 'clear_env = no' /etc/php81/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php81/php-fpm.d/www.conf && \
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php81/php-fpm.conf && \
echo "**** install snipe-it ****" && \
mkdir -p \
/app/www/ && \
Expand All @@ -63,7 +63,7 @@ RUN \
apk del --purge \
build-dependencies && \
rm -rf \
/root/.composer \
$HOME/.composer \
/tmp/*

# copy local files
Expand Down
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ services:
- PUID=1000
- PGID=1000
- APP_URL=http://localhost:8080
- MYSQL_PORT_3306_TCP_ADDR=<mysql host>
- MYSQL_PORT_3306_TCP_PORT=<mysql port>
- MYSQL_DATABASE=<mysql database>
- MYSQL_USER=<mysql pass>
- MYSQL_PASSWORD=changeme
- MYSQL_PORT_3306_TCP_ADDR=
- MYSQL_PORT_3306_TCP_PORT=
- MYSQL_DATABASE=
- MYSQL_USER=
- MYSQL_PASSWORD=
- TZ=US/Pacific
volumes:
- <path to snipe-it data>:/config
- /path/to/data:/config
ports:
- 8080:80
restart: unless-stopped
Expand All @@ -136,14 +136,14 @@ docker run -d \
-e PUID=1000 \
-e PGID=1000 \
-e APP_URL=http://localhost:8080 \
-e MYSQL_PORT_3306_TCP_ADDR=<mysql host> \
-e MYSQL_PORT_3306_TCP_PORT=<mysql port> \
-e MYSQL_DATABASE=<mysql database> \
-e MYSQL_USER=<mysql pass> \
-e MYSQL_PASSWORD=changeme \
-e MYSQL_PORT_3306_TCP_ADDR= \
-e MYSQL_PORT_3306_TCP_PORT= \
-e MYSQL_DATABASE= \
-e MYSQL_USER= \
-e MYSQL_PASSWORD= \
-e TZ=US/Pacific \
-p 8080:80 \
-v <path to snipe-it data>:/config \
-v /path/to/data:/config \
--restart unless-stopped \
lscr.io/linuxserver/snipe-it:latest
```
Expand All @@ -158,11 +158,11 @@ Container images are configured using parameters passed at runtime (such as thos
| `-e PUID=1000` | for UserID - see below for explanation |
| `-e PGID=1000` | for GroupID - see below for explanation |
| `-e APP_URL=http://localhost:8080` | Hostname or IP and port if applicable, be sure to define https/http |
| `-e MYSQL_PORT_3306_TCP_ADDR=<mysql host>` | Mysql hostname or IP to use |
| `-e MYSQL_PORT_3306_TCP_PORT=<mysql port>` | Mysql port to use |
| `-e MYSQL_DATABASE=<mysql database>` | Mysql database to use |
| `-e MYSQL_USER=<mysql pass>` | Mysql user to use |
| `-e MYSQL_PASSWORD=changeme` | Mysql password to use |
| `-e MYSQL_PORT_3306_TCP_ADDR=` | Mysql hostname or IP to use |
| `-e MYSQL_PORT_3306_TCP_PORT=` | Mysql port to use |
| `-e MYSQL_DATABASE=` | Mysql database to use |
| `-e MYSQL_USER=` | Mysql user to use |
| `-e MYSQL_PASSWORD=` | Mysql password to use |
| `-e TZ=US/Pacific` | Specify a timezone to use EG Europe/London, this is required to run snipe-it |
| `-v /config` | Contains your config files and data storage for Snipe-IT |

Expand Down Expand Up @@ -275,6 +275,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64

## Versions

* **28.12.22:** - Rebase to Alpine 3.17, migrate to s6v3.
* **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)).
* **14.05.22:** - Add php7-sodium for v6.
* **12.04.22:** - Don't build development elements.
Expand Down
13 changes: 7 additions & 6 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ common_param_env_vars_enabled: true #PGID, PUID, etc
param_container_name: "{{ project_name }}"
param_usage_include_vols: true
param_volumes:
- { vol_path: "/config", vol_host_path: "<path to {{ project_name }} data>", desc: "Contains your config files and data storage for Snipe-IT" }
- { vol_path: "/config", vol_host_path: "/path/to/data", desc: "Contains your config files and data storage for Snipe-IT" }
param_usage_include_ports: true
param_ports:
- { external_port: "8080", internal_port: "80", port_desc: "Snipe-IT Web UI" }
param_usage_include_env: true
param_env_vars:
- { env_var: "APP_URL", env_value: "http://localhost:8080", desc: "Hostname or IP and port if applicable, be sure to define https/http"}
- { env_var: "MYSQL_PORT_3306_TCP_ADDR", env_value: "<mysql host>", desc: "Mysql hostname or IP to use"}
- { env_var: "MYSQL_PORT_3306_TCP_PORT", env_value: "<mysql port>", desc: "Mysql port to use"}
- { env_var: "MYSQL_DATABASE", env_value: "<mysql database>", desc: "Mysql database to use"}
- { env_var: "MYSQL_USER", env_value: "<mysql pass>", desc: "Mysql user to use"}
- { env_var: "MYSQL_PASSWORD", env_value: "changeme", desc: "Mysql password to use"}
- { env_var: "MYSQL_PORT_3306_TCP_ADDR", env_value: "", desc: "Mysql hostname or IP to use"}
- { env_var: "MYSQL_PORT_3306_TCP_PORT", env_value: "", desc: "Mysql port to use"}
- { env_var: "MYSQL_DATABASE", env_value: "", desc: "Mysql database to use"}
- { env_var: "MYSQL_USER", env_value: "", desc: "Mysql user to use"}
- { env_var: "MYSQL_PASSWORD", env_value: "", desc: "Mysql password to use"}
- { env_var: "TZ", env_value: "US/Pacific", desc: "Specify a timezone to use EG Europe/London, this is required to run snipe-it"}

# application setup block
Expand Down Expand Up @@ -75,6 +75,7 @@ app_setup_block: |
# changelog
changelogs:
- { date: "28.12.22:", desc: "Rebase to Alpine 3.17, migrate to s6v3." }
- { 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: "14.05.22:", desc: "Add php7-sodium for v6." }
- { date: "12.04.22:", desc: "Don't build development elements." }
Expand Down
File renamed without changes.
Empty file.
Empty file.
10 changes: 5 additions & 5 deletions root/etc/cont-init.d/40-config → ...-overlay/s6-rc.d/init-snipe-it-config/run
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ if [[ ! -L /app/www/public/uploads ]]; then
fi

# Create API key if needed
if [ ! -f "/config/SNIPE_IT_APP_KEY.txt" ]; then
if [[ ! -f "/config/SNIPE_IT_APP_KEY.txt" ]]; then
echo "Generating SnipeIT app key for first run"
key=$(php /app/www/artisan key:generate --show)
echo "${key}" >/config/SNIPE_IT_APP_KEY.txt
echo "App Key set to ${key} you can modify the file to update /config/SNIPE_IT_APP_KEY.txt"
fi

# permissions
chown -R abc:abc \
lsiown -R abc:abc \
/config/ \
/app/www/bootstrap/cache

Expand All @@ -63,16 +63,16 @@ fi
sed -i "s/APP_URL_PLACEHOLDER/${REPLACE_URL}/g" /config/nginx/site-confs/default.conf

# If the Oauth DB files are not present copy the vendor files over to the db migrations
if [ ! -f "/app/www/database/migrations/*create_oauth*" ]; then
if [[ ! -f "/app/www/database/migrations/*create_oauth*" ]]; then
cp -ax /app/www/vendor/laravel/passport/database/migrations/* /app/www/database/migrations/
fi

# if this container is setup run migrate
if [ -f /config/storage/oauth-public.key ]; then
if [[ -f /config/storage/oauth-public.key ]]; then
php /app/www/artisan migrate --force
fi

# copy over timezone env var
if [[ -n ${TZ+x} ]]; then
echo "${TZ}" >/run/s6/container_environment/APP_TIMEZONE
printf '%s' "${TZ}" >/run/s6/container_environment/APP_TIMEZONE
fi
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/init-snipe-it-config/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/init-snipe-it-config/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-snipe-it-config/run
Empty file.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

export APP_KEY=$(cat /config/SNIPE_IT_APP_KEY.txt)
exec /usr/sbin/php-fpm8 -F

exec /usr/sbin/php-fpm81 -F
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-php-fpm/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.

0 comments on commit 6d7feb6

Please sign in to comment.