Skip to content

Commit 42e3eec

Browse files
Asherslablancepioch
authored andcommitted
Add docker files
1 parent d9948f2 commit 42e3eec

File tree

4 files changed

+105
-1
lines changed

4 files changed

+105
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sami.phar
2020
# For local development with docker
2121
# Remove if we ever put the Dockerfile in the repo
2222
.dockerignore
23-
Dockerfile
23+
#Dockerfile
2424
docker-compose.yml
2525
# for image related files
2626
misc

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM alpine:3.7
2+
3+
WORKDIR /app
4+
5+
RUN apk add --no-cache wget ca-certificates && \
6+
wget -O /etc/apk/keys/phpearth.rsa.pub https://repos.php.earth/alpine/phpearth.rsa.pub && \
7+
echo "https://repos.php.earth/alpine/v3.7" >> /etc/apk/repositories && \
8+
apk add --no-cache --update certbot nginx dcron curl tini php7.2 php7.2-bcmath php7.2-common php7.2-dom php7.2-fpm php7.2-gd php7.2-mbstring php7.2-openssl php7.2-zip php7.2-pdo php7.2-phar php7.2-json php7.2-pdo_mysql php7.2-session php7.2-ctype php7.2-tokenizer php7.2-zlib php7.2-simplexml && \
9+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
10+
11+
COPY . ./
12+
13+
COPY default.conf /etc/nginx/conf.d/default.conf
14+
15+
RUN cp .env.example .env
16+
RUN composer install --no-dev
17+
18+
19+
EXPOSE 80
20+
EXPOSE 443
21+
22+
RUN chown -R www-data:www-data .
23+
RUN chmod -R 777 storage/* bootstrap/cache /var/run/php
24+
25+
ENTRYPOINT ["ash", "entrypoint.sh"]
26+

default.conf

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# If using Ubuntu this file should be placed in:
2+
# /etc/nginx/sites-available/
3+
#
4+
# If using CentOS this file should be placed in:
5+
# /etc/nginx/conf.d/
6+
#
7+
server {
8+
listen 80;
9+
server_name _;
10+
11+
root /app/public;
12+
index index.html index.htm index.php;
13+
charset utf-8;
14+
15+
location / {
16+
try_files $uri $uri/ /index.php?$query_string;
17+
}
18+
19+
location = /favicon.ico { access_log off; log_not_found off; }
20+
location = /robots.txt { access_log off; log_not_found off; }
21+
22+
access_log off;
23+
error_log /var/log/nginx/pterodactyl.app-error.log error;
24+
25+
# allow larger file uploads and longer script runtimes
26+
client_max_body_size 100m;
27+
client_body_timeout 120s;
28+
29+
sendfile off;
30+
31+
location ~ \.php$ {
32+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
33+
# the fastcgi_pass path needs to be changed accordingly when using CentOS
34+
fastcgi_pass unix:/var/run/php/php-fpm7.2.sock;
35+
fastcgi_index index.php;
36+
include fastcgi_params;
37+
fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
38+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
39+
fastcgi_param HTTP_PROXY "";
40+
fastcgi_intercept_errors off;
41+
fastcgi_buffer_size 16k;
42+
fastcgi_buffers 4 16k;
43+
fastcgi_connect_timeout 300;
44+
fastcgi_send_timeout 300;
45+
fastcgi_read_timeout 300;
46+
}
47+
48+
location ~ /\.ht {
49+
deny all;
50+
}
51+
}

entrypoint.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/ash
2+
tini -- php-fpm
3+
4+
until nc -z -v -w30 $DB_HOST 3306
5+
do
6+
echo "Waiting for database connection..."
7+
# wait for 5 seconds before check again
8+
sleep 5
9+
done
10+
11+
sed -i s/DB_HOST=127.0.0.1/DB_HOST=$DB_HOST/g /app/.env
12+
sed -i s/DB_DATABASE=panel/DB_DATABASE=$DB_DATABASE/g /app/.env
13+
sed -i s/DB_USERNAME=pterodactyl/DB_USERNAME=$DB_USERNAME/g /app/.env
14+
sed -i s/DB_PASSWORD=/DB_PASSWORD=$DB_PASSWORD/g /app/.env
15+
16+
#echo "1"
17+
#chown -R www-data:www-data .
18+
#echo "2"
19+
#chmod -R 777 storage/* bootstrap/cache /var/run/php
20+
echo "3"
21+
php artisan key:generate --force
22+
echo "4"
23+
php artisan migrate --force
24+
echo "5"
25+
php artisan db:seed --force
26+
echo "Done"
27+
nginx -g 'pid /tmp/nginx.pid; daemon off;'

0 commit comments

Comments
 (0)