Improve Dockerfile
Add restart policy. Use Traefik
This commit is contained in:
parent
bf3bb03e7e
commit
b239d6aa18
3 changed files with 51 additions and 48 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
docker-compose.yml
|
|
|
@ -1,53 +1,60 @@
|
||||||
version: "3"
|
version: "3.1"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
db:
|
db:
|
||||||
|
image: mariadb
|
||||||
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- "MYSQL_DATABASE=pterodactyl"
|
- "MYSQL_DATABASE=pterodactyl"
|
||||||
- "MYSQL_PASSWORD=pterodactyl"
|
- "MYSQL_PASSWORD=pterodactyl"
|
||||||
- "MYSQL_RANDOM_ROOT_PASSWORD=yes"
|
- "MYSQL_RANDOM_ROOT_PASSWORD=yes"
|
||||||
- "MYSQL_USER=pterodactyl"
|
- "MYSQL_USER=pterodactyl"
|
||||||
image: mariadb:latest
|
|
||||||
networks:
|
networks:
|
||||||
|
- traefik
|
||||||
- default
|
- default
|
||||||
volumes:
|
volumes:
|
||||||
- db:/var/lib/mysql
|
- ./db:/var/lib/mysql
|
||||||
|
|
||||||
http:
|
http:
|
||||||
build:
|
build:
|
||||||
context: services/http
|
context: services/http
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- "php"
|
- "php"
|
||||||
ports:
|
expose:
|
||||||
- "80:80"
|
- 80
|
||||||
networks:
|
networks:
|
||||||
|
- traefik
|
||||||
- default
|
- default
|
||||||
volumes:
|
volumes:
|
||||||
- env:/var/www/html/env
|
- ./env:/var/www/html/env
|
||||||
- panel:/var/www/html/pterodactyl
|
- ./panel:/var/www/html/pterodactyl
|
||||||
- storage:/var/www/html/pterodactyl/storage
|
- ./storage:/var/www/html/pterodactyl/storage
|
||||||
|
|
||||||
php:
|
php:
|
||||||
build:
|
build:
|
||||||
context: services/php
|
context: services/php
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- "db"
|
- "db"
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
volumes:
|
volumes:
|
||||||
- env:/var/www/html/env
|
- ./env:/var/www/html/env
|
||||||
- panel:/var/www/html/pterodactyl
|
- ./panel:/var/www/html/pterodactyl
|
||||||
- storage:/var/www/html/pterodactyl/storage
|
- ./storage:/var/www/html/pterodactyl/storage
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine
|
image: redis:alpine
|
||||||
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
traefik:
|
||||||
volumes:
|
external: true
|
||||||
db:
|
|
||||||
env:
|
|
||||||
panel:
|
|
||||||
storage:
|
|
|
@ -1,52 +1,49 @@
|
||||||
FROM php:7.2-fpm-alpine
|
FROM php:7.2-fpm-alpine
|
||||||
|
|
||||||
ENV PANEL_VERSION=v0.7.7
|
ENV PANEL_VERSION=v0.7.9
|
||||||
|
|
||||||
# Set up all the dependencies for the PHP container.
|
# Set up all the dependencies for the PHP container.
|
||||||
RUN apk add --no-cache curl git supervisor tar unzip
|
RUN apk add --no-cache curl git supervisor tar unzip; \
|
||||||
RUN docker-php-ext-install bcmath
|
docker-php-ext-install bcmath; \
|
||||||
# https://github.com/docker-library/php/issues/483
|
apk add --no-cache libpng-dev; \
|
||||||
# RUN docker-php-ext-install curl
|
docker-php-ext-install gd; \
|
||||||
# https://stackoverflow.com/questions/39657058/installing-gd-in-docker#39658592
|
docker-php-ext-install mbstring; \
|
||||||
RUN apk add --no-cache libpng-dev
|
docker-php-ext-install pdo; \
|
||||||
RUN docker-php-ext-install gd
|
docker-php-ext-install pdo_mysql; \
|
||||||
RUN docker-php-ext-install mbstring
|
docker-php-ext-install tokenizer; \
|
||||||
RUN docker-php-ext-install pdo
|
apk add --no-cache libxml2-dev; \
|
||||||
RUN docker-php-ext-install pdo_mysql
|
docker-php-ext-install xml; \
|
||||||
RUN docker-php-ext-install tokenizer
|
docker-php-ext-install zip; \
|
||||||
# https://lists.alpinelinux.org/alpine-aports/2526.html
|
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||||
RUN apk add --no-cache libxml2-dev
|
|
||||||
RUN docker-php-ext-install xml
|
|
||||||
RUN docker-php-ext-install zip
|
|
||||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
||||||
|
|
||||||
# Set up the server working directories.
|
# Set up the server working directories.
|
||||||
RUN adduser -g '' -D -u 9999 pterodactyl
|
RUN adduser -g '' -D -u 9999 pterodactyl; \
|
||||||
RUN mkdir -p /var/www/html/env
|
mkdir -p /var/www/html/env; \
|
||||||
RUN mkdir -p /var/www/html/pterodactyl
|
mkdir -p /var/www/html/pterodactyl
|
||||||
|
|
||||||
WORKDIR /var/www/html/pterodactyl
|
WORKDIR /var/www/html/pterodactyl
|
||||||
RUN chown -R pterodactyl:pterodactyl /var/www/html/pterodactyl /var/www/html/env
|
RUN chown -R pterodactyl:pterodactyl /var/www/html/pterodactyl /var/www/html/env
|
||||||
|
|
||||||
# Deploy panel files.
|
# Deploy panel files.
|
||||||
USER pterodactyl:pterodactyl
|
USER pterodactyl:pterodactyl
|
||||||
RUN curl -Lo panel.tar.gz https://github.com/Pterodactyl/Panel/releases/download/${PANEL_VERSION}/panel.tar.gz
|
RUN curl -Lo panel.tar.gz https://github.com/Pterodactyl/Panel/releases/download/${PANEL_VERSION}/panel.tar.gz; \
|
||||||
RUN tar --strip-components=1 -xzvf panel.tar.gz
|
tar --strip-components=1 -xzvf panel.tar.gz; \
|
||||||
# Since Docker's configuration mounting feature sucks, we're going to use a cheap
|
cp .env.example /var/www/html/env/.env; \
|
||||||
# workaround involving symbolic links.
|
ln -s /var/www/html/env/.env /var/www/html/pterodactyl/.env; \
|
||||||
RUN cp .env.example /var/www/html/env/.env
|
composer install --no-dev; \
|
||||||
RUN ln -s /var/www/html/env/.env /var/www/html/pterodactyl/.env
|
chmod -R 755 storage/* bootstrap/cache
|
||||||
RUN composer install --no-dev
|
|
||||||
RUN chmod -R 755 storage/* bootstrap/cache
|
|
||||||
|
|
||||||
# Copy the remaining configuration files.
|
# Copy the remaining configuration files.
|
||||||
USER root:root
|
USER root:root
|
||||||
RUN mkdir -p /var/log/pterodactyl
|
RUN mkdir -p /var/log/pterodactyl
|
||||||
|
|
||||||
COPY install.sh /usr/local/bin/install
|
COPY install.sh /usr/local/bin/install
|
||||||
RUN chmod +x /usr/local/bin/install
|
|
||||||
COPY upgrade.sh /usr/local/bin/upgrade
|
COPY upgrade.sh /usr/local/bin/upgrade
|
||||||
RUN chmod +x /usr/local/bin/upgrade
|
|
||||||
COPY schedule /var/spoon/cron/crontabs/schedule
|
COPY schedule /var/spoon/cron/crontabs/schedule
|
||||||
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
||||||
COPY www.conf /usr/local/etc/php-fpm.d/www.conf
|
COPY www.conf /usr/local/etc/php-fpm.d/www.conf
|
||||||
|
|
||||||
|
RUN chmod +x /usr/local/bin/install; \
|
||||||
|
chmod +x /usr/local/bin/upgrade
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
|
ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
|
||||||
|
|
Reference in a new issue