Skip to content

Commit

Permalink
Merge pull request #1672 from PyRowMan/dockerfilev2
Browse files Browse the repository at this point in the history
Add a prod Dockerfile
  • Loading branch information
DariusIII authored Dec 26, 2024
2 parents 20effc1 + abf8bc2 commit 2c5ae82
Show file tree
Hide file tree
Showing 9 changed files with 605 additions and 40 deletions.
5 changes: 3 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ vendor/
docker/mariadb-data
docker/redis-data
docker/manticore-data
storage
resources
.env
storage/nzb
storage/covers
209 changes: 209 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
DB_CONNECTION=${DB_CONNECTION}
DB_HOST=${DB_HOST}
DB_PORT=${DB_PORT}
DB_ROOTPASSWORD=${DB_ROOTPASSWORD}
DB_SOCKET=${DB_SOCKET}
DB_USERNAME=${DB_USERNAME}
DB_PASSWORD=${DB_PASSWORD}
DB_DATABASE=${DB_DATABASE}

COMPOSER_AUTH='${COMPOSER_AUTH}'

MANTICORESEARCH_HOST=${MANTICORESEARCH_HOST}
MANTICORESEARCH_PORT=${MANTICORESEARCH_PORT}

ELASTICSEARCH_HOST=${ELASTICSEARCH_HOST}
ELASTICSEARCH_PORT=${ELASTICSEARCH_PORT}
ELASTICSEARCH_SCHEME=${ELASTICSEARCH_SCHEME}
ELASTICSEARCH_USER=${ELASTICSEARCH_USER}
ELASTICSEARCH_PASS=${ELASTICSEARCH_PASS}
ELASTICSEARCH_LOGGING=${ELASTICSEARCH_LOGGING}
ELASTICSEARCH_ENABLED=${ELASTICSEARCH_ENABLED}

NNTP_COMPRESSED_HEADERS=${NNTP_COMPRESSED_HEADERS}
USE_ALTERNATE_NNTP_SERVER=${USE_ALTERNATE_NNTP_SERVER}

NNTP_USERNAME=${NNTP_USERNAME}
NNTP_PASSWORD=${NNTP_PASSWORD}
NNTP_SERVER=${NNTP_SERVER}
NNTP_PORT=${NNTP_PORT}
NNTP_CONNECTIONS=${NNTP_CONNECTIONS}
NNTP_SSLENABLED=${NNTP_SSLENABLED}
NNTP_SOCKET_TIMEOUT=${NNTP_SOCKET_TIMEOUT}

NNTP_USERNAME_A=${NNTP_USERNAME_A}
NNTP_PASSWORD_A=${NNTP_PASSWORD_A}
NNTP_SERVER_A=${NNTP_SERVER_A}
NNTP_PORT_A=${NNTP_PORT_A}
NNTP_CONNECTIONS_A=${NNTP_CONNECTIONS_A}
NNTP_SSLENABLED_A=${NNTP_SSLENABLED_A}
NNTP_SOCKET_TIMEOUT_A=${NNTP_SOCKET_TIMEOUT_A}

NN_MULTIPROCESSING_MAX_CHILD_TIME=${NN_MULTIPROCESSING_MAX_CHILD_TIME}

ADMIN_USER=${ADMIN_USER}
ADMIN_PASS=${ADMIN_PASS}
ADMIN_EMAIL=${ADMIN_EMAIL}

APP_NAME=${APP_NAME}
APP_ENV=${APP_ENV}
APP_DEBUG=${APP_DEBUG}
APP_TIMEZONE=${APP_TIMEZONE}
APP_URL=${APP_URL}

APP_LOCALE=${APP_LOCALE}
APP_FALLBACK_LOCALE=${APP_FALLBACK_LOCALE}
APP_FAKER_LOCALE=${APP_FAKER_LOCALE}

APP_MAINTENANCE_DRIVER=${APP_MAINTENANCE_DRIVER}
APP_MAINTENANCE_STORE=${APP_MAINTENANCE_STORE}

BCRYPT_ROUNDS=${BCRYPT_ROUNDS}
APP_KEY=${APP_KEY}
LOG_CHANNEL=${LOG_CHANNEL}
LOG_STACK=${LOG_STACK}
PASSWORD_HASH=${PASSWORD_HASH}

BROADCAST_CONNECTION=${BROADCAST_CONNECTION}
CACHE_STORE=${CACHE_STORE}
QUEUE_CONNECTION=${QUEUE_CONNECTION}

REDIS_HOST=${REDIS_HOST}
REDIS_PASSWORD=${REDIS_PASSWORD}
REDIS_PORT=${REDIS_PORT}
REDIS_CLIENT=${REDIS_CLIENT}

SESSION_DRIVER=${SESSION_DRIVER}
SESSION_DOMAIN=${SESSION_DOMAIN}
SESSION_SECURE_COOKIE=${SESSION_SECURE_COOKIE}
SESSION_ENCRYPT=${SESSION_ENCRYPT}
SESSION_COOKIE=${SESSION_COOKIE}
SESSION_PATH=${SESSION_PATH}

MAIL_DRIVER=${MAIL_DRIVER}
MAIL_HOST=${MAIL_HOST}
MAIL_PORT=${MAIL_PORT}
MAIL_USERNAME=${MAIL_USERNAME}
MAIL_PASSWORD=${MAIL_PASSWORD}
MAIL_ENCRYPTION=${MAIL_ENCRYPTION}
MAIL_FROM_ADDRESS=${MAIL_FROM_ADDRESS}
MAIL_FROM_NAME=${MAIL_FROM_NAME}

AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}
AWS_BUCKET=${AWS_BUCKET}

PUSHER_APP_ID=${PUSHER_APP_ID}
PUSHER_APP_KEY=${PUSHER_APP_KEY}
PUSHER_APP_SECRET=${PUSHER_APP_SECRET}
PUSHER_APP_CLUSTER=${PUSHER_APP_CLUSTER}

MIX_PUSHER_APP_KEY=${PUSHER_APP_KEY}
MIX_PUSHER_APP_CLUSTER=${PUSHER_APP_CLUSTER}

NOCAPTCHA_ENABLED=${NOCAPTCHA_ENABLED}
NOCAPTCHA_SITEKEY=${NOCAPTCHA_SITEKEY}
NOCAPTCHA_SECRET=${NOCAPTCHA_SECRET}

SCOUT_DRIVER=${SCOUT_DRIVER}
SCOUT_QUEUE=${SCOUT_QUEUE}

ITEMS_PER_PAGE=${ITEMS_PER_PAGE}
ITEMS_PER_COVER_PAGE=${ITEMS_PER_COVER_PAGE}
MAX_PAGER_RESULTS=${MAX_PAGER_RESULTS}
ECHOCLI=${ECHOCLI}
RENAME_PAR2=${RENAME_PAR2}
ADD_PAR2=${ADD_PAR2}
RENAME_MUSIC_MEDIAINFO=${RENAME_MUSIC_MEDIAINFO}
CACHE_EXPIRY_SHORT=${CACHE_EXPIRY_SHORT}
CACHE_EXPIRY_MEDIUM=${CACHE_EXPIRY_MEDIUM}
CACHE_EXPIRY_LONG=${CACHE_EXPIRY_LONG}

SSL_CAFILE=${SSL_CAFILE}
SSL_CAPATH=${SSL_CAPATH}
SSL_VERIFY_PEER=${SSL_VERIFY_PEER}
SSL_VERIFY_HOST=${SSL_VERIFY_HOST}
SSL_ALLOW_SELF_SIGNED=${SSL_ALLOW_SELF_SIGNED}

SCRAPE_IRC_USERNAME=${SCRAPE_IRC_USERNAME}
SCRAPE_IRC_SERVER=${SCRAPE_IRC_SERVER}
SCRAPE_IRC_PORT=${SCRAPE_IRC_PORT}
SCRAPE_IRC_TLS=${SCRAPE_IRC_TLS}
SCRAPE_IRC_PASSWORD=${SCRAPE_IRC_PASSWORD}

SMARTY_DEBUG=${SMARTY_DEBUG}
SMARTY_CACHING=${SMARTY_CACHING}
SMARTY_CACHE_LIFE=${SMARTY_CACHE_LIFE}
SMARTY_COMPILE_CHECK=${SMARTY_COMPILE_CHECK}
SMARTY_FORCE_COMPILE=${SMARTY_FORCE_COMPILE}
SMARTY_CACHE_DRIVER=${SMARTY_CACHE_DRIVER}

TWITCH_CLIENT_ID=${TWITCH_CLIENT_ID}
TWITCH_CLIENT_SECRET=${TWITCH_CLIENT_SECRET}
IGDB_CACHE_LIFETIME=${IGDB_CACHE_LIFETIME}
TMDB_APIKEY=${TMDB_APIKEY}
TMDB_CACHE=${TMDB_CACHE}
TMDB_LOG=${TMDB_LOG}
TVDB_APIKEY=${TVDB_APIKEY}
TVDB_PIN=${TVDB_PIN}
GIANTBOMB_APIKEY=${GIANTBOMB_APIKEY}
ANIDB_APIKEY=${ANIDB_APIKEY}
FANARTTV_APIKEY=${FANARTTV_APIKEY}
OMDB_APIKEY=${OMDB_APIKEY}
TRAKTTV_APIKEY=${TRAKTTV_APIKEY}

TEMP_UNRAR_PATH=${TEMP_UNRAR_PATH}
TEMP_UNZIP_PATH=${TEMP_UNZIP_PATH}

VIEW_COMPILED_PATH=${VIEW_COMPILED_PATH}
UNRAR_PATH=${UNRAR_PATH}
UNZIP_PATH=${UNZIP_PATH}
FFMPEG_PATH=${FFMPEG_PATH}
LAME_PATH=${LAME_PATH}
MEDIAINFO_PATH=${MEDIAINFO_PATH}
TIIMEOUT_PATH=${TIIMEOUT_PATH}
MAGIC_FILE_PATH=${MAGIC_FILE_PATH}
COVERS_PATH=${COVERS_PATH}
PATH_TO_NZBS=${PATH_TO_NZBS}

ASSET_URL=${ASSET_URL}

TELESCOPE_DRIVER=${TELESCOPE_DRIVER}
TELESCOPE_ENABLED=${TELESCOPE_ENABLED}
TELESCOPE_FULL_IN_PRODUCTION=${TELESCOPE_FULL_IN_PRODUCTION}
TELESCOPE_CACHE_WATCHER=${TELESCOPE_CACHE_WATCHER}
TELESCOPE_COMMAND_WATCHER=${TELESCOPE_COMMAND_WATCHER}
TELESCOPE_DUMP_WATCHER=${TELESCOPE_DUMP_WATCHER}
TELESCOPE_EVENT_WATCHER=${TELESCOPE_EVENT_WATCHER}
TELESCOPE_EXCEPTION_WATCHER=${TELESCOPE_EXCEPTION_WATCHER}
TELESCOPE_JOB_WATCHER=${TELESCOPE_JOB_WATCHER}
TELESCOPE_LOG_WATCHER=${TELESCOPE_LOG_WATCHER}
TELESCOPE_MAIL_WATCHER=${TELESCOPE_MAIL_WATCHER}
TELESCOPE_MODEL_WATCHER=${TELESCOPE_MODEL_WATCHER}
TELESCOPE_NOTIFICATION_WATCHER=${TELESCOPE_NOTIFICATION_WATCHER}
TELESCOPE_QUERY_WATCHER=${TELESCOPE_QUERY_WATCHER}
TELESCOPE_REDIS_WATCHER=${TELESCOPE_REDIS_WATCHER}
TELESCOPE_REQUEST_WATCHER=${TELESCOPE_REQUEST_WATCHER}
TELESCOPE_RESPONSE_SIZE_LIMIT=${TELESCOPE_RESPONSE_SIZE_LIMIT}
TELESCOPE_GATE_WATCHER=${TELESCOPE_GATE_WATCHER}
TELESCOPE_SCHEDULE_WATCHER=${TELESCOPE_SCHEDULE_WATCHER}

HORIZON_PREFIX=${HORIZON_PREFIX}

POSTMARK_TOKEN=${POSTMARK_TOKEN}

PURGE_INACTIVE_USERS=${PURGE_INACTIVE_USERS}

OTP_ENABLED=${OTP_ENABLED}

FLARE_KEY=${FLARE_KEY}

CHECK_PASSWORDED_RARS=${CHECK_PASSWORDED_RARS}
DELETE_PASSWORDED_RELEASES=${DELETE_PASSWORDED_RELEASES}
DELETE_POSSIBLE_PASSWORDED_RELEASES=${DELETE_POSSIBLE_PASSWORDED_RELEASES}
EXTRACT_USING_RARINFO=${EXTRACT_USING_RARINFO}
PRIVATE_PROFILES=${PRIVATE_PROFILES}
STORE_USER_IP=${STORE_USER_IP}

FORUM_FRONTEND_ENABLED=${FORUM_FRONTEND_ENABLED}
19 changes: 10 additions & 9 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,16 @@ TEMP_UNRAR_PATH='/var/www/nntmux/resources/tmp/unrar/'
TEMP_UNZIP_PATH='/var/www/nntmux/resources/tmp/unzip/'

VIEW_COMPILED_PATH=/var/www/NNTmux/storage/framework/views
UNRAR_PATH=
UNZIP_PATH=
PATH_TO_NZBS=
FFMPEG_PATH=
LAME_PATH=
MEDIAINFO_PATH=
TIIMEOUT_PATH=
MAGIC_FILE_PATH=
COVERS_PATH=

ASSET_URL=

TELESCOPE_DRIVER=database
Expand Down Expand Up @@ -189,20 +199,11 @@ OTP_ENABLED=false

FLARE_KEY=

UNRAR_PATH=
UNZIP_PATH=
CHECK_PASSWORDED_RARS=false
DELETE_PASSWORDED_RELEASES=false
DELETE_POSSIBLE_PASSWORDED_RELEASES=false
EXTRACT_USING_RARINFO=false
PATH_TO_NZBS=
PRIVATE_PROFILES=true
STORE_USER_IP=false
FFMPEG_PATH=
LAME_PATH=
MEDIAINFO_PATH=
TIIMEOUT_PATH=
MAGIC_FILE_PATH=
COVERS_PATH=

FORUM_FRONTEND_ENABLED=false
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ failed-login.log
php_errors.log
php-errors.log
test.php
.php-cs-fixer.cache

# Editor temp files
*#
Expand Down Expand Up @@ -39,4 +40,4 @@ node_modules/
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

/.phpunit.cache
/.phpunit.cache
73 changes: 73 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

FROM composer:latest AS composer-base
FROM dunglas/frankenphp:1-php8.3
LABEL maintainer="PyRowMan"
ENV SERVER_NAME=:80
ARG MYSQL_CLIENT="mariadb-client"
ARG SEVENZIP_VERSION=2407

WORKDIR /app


COPY --from=node:21 /usr/local/ /usr/local/
COPY --from=composer-base --link /usr/bin/composer /usr/bin/composer

RUN apt update \
&& apt install -y --no-install-recommends \
unrar-free 7zip lame libcap2-bin python3 gettext-base \
curl zip unzip git nano bash-completion sudo wget tmux time fonts-powerline \
gnupg libpng-dev dnsutils jq htop iputils-ping net-tools ffmpeg \
jpegoptim webp optipng pngquant libavif-bin watch iproute2 nmon \
libonig-dev libxml2-dev libicu-dev libjpeg-dev libfreetype6-dev libxslt-dev $MYSQL_CLIENT libcurl4-openssl-dev \
&& wget https://mediaarea.net/repo/deb/repo-mediaarea_1.0-24_all.deb \
&& dpkg -i repo-mediaarea_1.0-24_all.deb \
&& apt update \
&& apt install -y libmediainfo0v5 mediainfo libzen0v5
RUN install-php-extensions imagick/imagick@master
RUN docker-php-ext-install \
bcmath \
exif \
gd \
intl \
pdo_mysql \
sockets \
pcntl \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& apt clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Determine ARCH and download and extract the appropriate version of 7-Zip
RUN ARCH="$(dpkg --print-architecture)" && \
if [ "$ARCH" = "amd64" ]; then \
SZIP_URL="https://www.7-zip.org/a/7z$SEVENZIP_VERSION-linux-x64.tar.xz"; \
fi && \
if [ "$ARCH" = "arm64" ]; then \
SZIP_URL="https://www.7-zip.org/a/7z$SEVENZIP_VERSION-linux-arm64.tar.xz"; \
fi && \
wget "$SZIP_URL" -O /tmp/7z.tar.xz && \
tar -xf /tmp/7z.tar.xz -C /tmp/ && \
mv /tmp/7zz /usr/bin/7zz && \
rm -f /tmp/7z.tar.xz && rm -f /tmp/7zzs

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY ./docker/8.3/php.ini "$PHP_INI_DIR/conf.d/custom-conf.ini"

COPY --chmod=755 ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint

COPY . /app

RUN rm -Rf tests/

RUN composer install

RUN chmod -R 755 /app/vendor/
RUN chmod -R 777 /app/storage/
RUN chmod -R 777 /app/resources/
RUN chmod -R 777 /app/public/

EXPOSE 80

CMD ["--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
ENTRYPOINT ["docker-entrypoint"]


Loading

0 comments on commit 2c5ae82

Please sign in to comment.