consolodate images

This commit is contained in:
Aode 2020-02-14 19:07:56 -06:00
parent 9d316cefb4
commit 5bceb10e38
20 changed files with 2 additions and 281 deletions

View file

@ -1,4 +1,4 @@
FROM lsiobase/alpine:arm64v8-3.11
FROM lsiobase/nginx:arm64v8-3.11
# set version label
ARG BUILD_DATE
@ -13,43 +13,28 @@ ENV PIXELFED_PATH="/srv/www/pixelfed"
RUN \
echo "**** install runtime packages ****" && \
apk add --no-cache --upgrade \
apache2-utils \
curl \
ffmpeg \
git \
imagemagick \
jpegoptim \
libressl3.0-libssl \
libxml2 \
nano \
openssl \
optipng \
php7 \
php7-bcmath \
php7-ctype \
php7-curl \
php7-dom \
php7-exif \
php7-fileinfo \
php7-gd \
php7-iconv \
php7-imagick \
php7-intl \
php7-json \
php7-mbstring \
php7-openssl \
php7-pcntl \
php7-pdo_pgsql \
php7-pgsql \
php7-phar \
php7-posix \
php7-session \
php7-simplexml \
php7-tokenizer \
php7-xml \
php7-xmlwriter \
php7-zip \
php7-zlib \
pngquant \
rsync \
sudo \
@ -98,4 +83,5 @@ USER root
# copy local files
COPY root/ /
EXPOSE 80
VOLUME /srv/www/pixelfed/storage

View file

@ -49,10 +49,4 @@ require "$PIXELFED_RELEASE" "pixelfed release"
set -xe
pushd base
build_image asonix/pixelfed-base arm64v8
popd
pushd web
build_image asonix/pixelfed arm64v8
popd

View file

@ -1,34 +0,0 @@
FROM asonix/pixelfed-base:latest-arm64v8
# set version label
ARG BUILD_DATE
ARG VERSION
ARG PIXELFED_RELEASE
LABEL build_version="Build version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="asonix"
# environment settings
ENV PIXELFED_PATH="/srv/www/pixelfed"
RUN \
echo "**** install runtime packages ****" && \
apk add --no-cache --upgrade \
logrotate \
nginx \
php7-fpm && \
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php7/php-fpm.conf && \
sed -i'' 's/;clear_env.*/clear_env = no/g' /etc/php7/php-fpm.d/www.conf && \
echo "**** configure nginx ****" && \
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
/etc/nginx/fastcgi_params && \
rm -f /etc/nginx/conf.d/default.conf && \
echo "**** fix logrotate ****" && \
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
/etc/periodic/daily/logrotate
# copy local files
COPY root/ /
EXPOSE 80
VOLUME /srv/www/pixelfed/storage

View file

@ -1,101 +0,0 @@
## Version 2018/08/16 - Changelog: https://github.com/linuxserver/docker-baseimage-alpine-nginx/commits/master/root/defaults/nginx.conf
user abc;
worker_processes 4;
pid /run/nginx.pid;
include /etc/nginx/modules/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
client_max_body_size 0;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /config/log/nginx/access.log;
error_log /config/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /config/nginx/site-confs/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
daemon off;

View file

@ -1,29 +0,0 @@
#!/bin/bash
pfpath="${PIXELFED_PATH}"
htuser='abc'
htgroup='abc'
rootuser='root'
printf "chmod Files and Directories\n"
find ${pfpath}/ -type f -print0 | xargs -0 chmod 0640
find ${pfpath}/ -type d -print0 | xargs -0 chmod 0750
printf "chown Directories\n"
chown -R ${rootuser}:${htgroup} ${pfpath}/
chown -R ${htuser}:${htgroup} ${pfpath}/app/
chown -R ${htuser}:${htgroup} ${pfpath}/bootstrap/
chown -R ${htuser}:${htgroup} ${pfpath}/config/
chown -R ${htuser}:${htgroup} ${pfpath}/public/
chown -R ${htuser}:${htgroup} ${pfpath}/resources/
chown -R ${htuser}:${htgroup} ${pfpath}/routes/
chown -R ${htuser}:${htgroup} ${pfpath}/storage/
chmod +x ${pfpath}/artisan
printf "chmod/chown .htaccess\n"
if [ -f ${pfpath}/public/.htaccess ]
then
chmod 0644 ${pfpath}/public/.htaccess
chown ${rootuser}:${htgroup} ${pfpath}/.htaccess
fi

View file

@ -1,41 +0,0 @@
#!/usr/bin/with-contenv bash
# make our folders
mkdir -p \
/config/{nginx/site-confs,www,log/nginx,keys,log/php,php} \
/run \
/var/lib/nginx/tmp/client_body \
/var/tmp/nginx
# copy config files
[[ ! -f /config/nginx/nginx.conf ]] && \
cp /defaults/nginx.conf /config/nginx/nginx.conf
[[ ! -f /config/nginx/site-confs/default ]] && \
cp /defaults/default /config/nginx/site-confs/default
[[ $(find /config/www -type f | wc -l) -eq 0 ]] && \
cp /defaults/index.html /config/www/index.html
# create local php.ini if it doesn't exist, set local timezone
[[ ! -f /config/php/php-local.ini ]] && \
printf "; Edit this file to override php.ini directives and restart the container\\n\\ndate.timezone = %s\\n" "$TZ" > /config/php/php-local.ini
# copy user php-local.ini to image
cp /config/php/php-local.ini /etc/php7/conf.d/php-local.ini
#fix php-fpm log location
sed -i "s#;error_log = log/php7/error.log.*#error_log = /config/log/php/error.log#g" /etc/php7/php-fpm.conf
#fix php-fpm user
sed -i "s#user = nobody.*#user = abc#g" /etc/php7/php-fpm.d/www.conf
sed -i "s#group = nobody.*#group = abc#g" /etc/php7/php-fpm.d/www.conf
# create override for www.conf if it doesn't exist
[[ ! -f /config/php/www2.conf ]] && \
printf "; Edit this file to override www.conf and php-fpm.conf directives and restart the container\\n\\n; Pool name\\n[www]\\n\\n" > /config/php/www2.conf
# copy user www2.conf to image
cp /config/php/www2.conf /etc/php7/php-fpm.d/www2.conf
# permissions
chown -R abc:abc \
/config \
/var/lib/nginx \
/var/tmp/nginx
chmod -R g+w \
/config/{nginx,www}
chmod -R 644 /etc/logrotate.d

View file

@ -1,7 +0,0 @@
#!/usr/bin/with-contenv bash
# permissions
chown abc:abc \
/config
chown -R abc:abc \
/var/lib/nginx

View file

@ -1,13 +0,0 @@
#!/usr/bin/with-contenv bash
# prepare app
pushd "${PIXELFED_PATH}"
pixelfed rsync -rog storage-default/* storage/
pixelfed php artisan storage:link
pixelfed php artisan config:cache
pixelfed php artisan horizon:install
pixelfed php artisan horizon:assets
pixelfed php artisan route:cache
pixelfed php artisan view:cache
pixelfed php artisan optimize
popd

View file

@ -1,14 +0,0 @@
/config/log/nginx/*.log {
weekly
rotate 14
compress
delaycompress
nodateext
notifempty
missingok
sharedscripts
postrotate
s6-svc -h /var/run/s6/services/nginx
endscript
su abc abc
}

View file

@ -1,14 +0,0 @@
/config/log/php/*.log {
rotate 7
weekly
missingok
notifempty
delaycompress
compress
nodateext
sharedscripts
postrotate
s6-svc -t /var/run/s6/services/php-fpm
endscript
su abc abc
}

View file

@ -1,3 +0,0 @@
#!/usr/bin/with-contenv bash
exec /usr/sbin/nginx -c /config/nginx/nginx.conf

View file

@ -1,3 +0,0 @@
#!/usr/bin/with-contenv bash
exec /usr/sbin/php-fpm7 -F