Skip to content

Commit e84008d

Browse files
committed
Merge branch 'dane/docker' into develop
2 parents 3b4a096 + 4ef04aa commit e84008d

File tree

11 files changed

+133
-108
lines changed

11 files changed

+133
-108
lines changed
File renamed without changes.
Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
#!/bin/ash
2-
## Ensure we are in /app
3-
42
cd /app
53

64
mkdir -p /var/log/panel/logs/ /var/log/supervisord/ /var/log/nginx/ /var/log/php7/ \
7-
&& rm -rf /app/storage/logs/ \
8-
&& chmod 777 /var/log/panel/logs/ \
9-
&& ln -s /var/log/panel/logs/ /app/storage/
5+
&& chmod 777 /var/log/panel/logs/ \
6+
&& ln -s /var/log/panel/logs/ /app/storage/logs/
107

118
## check for .env file and generate app keys if missing
129
if [ -f /app/var/.env ]; then
1310
echo "external vars exist."
1411
rm -rf /app/.env
15-
1612
ln -s /app/var/.env /app/
1713
else
1814
echo "external vars don't exist."
@@ -60,26 +56,19 @@ fi
6056
## check for DB up before starting the panel
6157
echo "Checking database status."
6258
until nc -z -v -w30 $DB_HOST 3306
63-
6459
do
6560
echo "Waiting for database connection..."
66-
# wait for 5 seconds before check again
67-
sleep 5
61+
# wait for 1 seconds before check again
62+
sleep 1
6863
done
6964

7065
## make sure the db is set up
7166
echo -e "Migrating and Seeding D.B"
72-
php artisan migrate --force
73-
php artisan db:seed --force
67+
php artisan migrate --seed --force
7468

7569
## start cronjobs for the queue
7670
echo -e "Starting cron jobs."
7771
crond -L /var/log/crond -l 5
7872

79-
## install yarn stuff
80-
yarn install --production
81-
yarn add cross-env
82-
yarn run build:production
83-
8473
echo -e "Starting supervisord."
8574
exec "$@"
File renamed without changes.

.github/workflows/docker.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish Docker Image
2+
on:
3+
push:
4+
branches:
5+
- 'develop'
6+
tags:
7+
- 'v*'
8+
jobs:
9+
push_to_registry:
10+
name: Push Image to Github Packages
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: docker/setup-qemu-action@v1
15+
- uses: docker/setup-buildx-action@v1
16+
- uses: docker/login-action@v1
17+
with:
18+
registry: ghcr.io
19+
username: ${{ github.repository_owner }}
20+
password: ${{ secrets.REGISTRY_TOKEN }}
21+
- name: Release Production Build
22+
uses: docker/build-push-action@v2
23+
if: contains(github.ref, 'develop') != true
24+
env:
25+
GITHUB_REF: ${{ github.ref }}
26+
with:
27+
push: true
28+
tags: |
29+
ghcr.io/pterodactyl/panel:latest
30+
ghcr.io/pterodactyl/panel:${GITHUB_REF}
31+
- name: Release Development Build
32+
uses: docker/build-push-action@v2
33+
if: contains(github.ref, 'develop') && && !contains(github.event.head_commit.message, '[skip docker]') && !contains(github.event.head_commit.message, '[docker skip]')
34+
with:
35+
push: true
36+
tags: |
37+
ghcr.io/pterodactyl/panel:develop

.github/workflows/release.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
name: "Release"
2-
1+
name: Create Release
32
on:
43
push:
54
tags:
65
- 'v*'
7-
86
jobs:
97
release:
108
runs-on: ubuntu-20.04
@@ -13,7 +11,7 @@ jobs:
1311
- uses: actions/setup-node@v1
1412
with:
1513
node-version: '12'
16-
14+
1715
- name: Create release branch and bump version
1816
env:
1917
REF: ${{ github.ref }}
@@ -32,7 +30,7 @@ jobs:
3230
run: |
3331
yarn install
3432
yarn run build:production
35-
33+
3634
- name: Create release archive
3735
run: |
3836
rm -rf node_modules/ test/ codecov.yml CODE_OF_CONDUCT.md CONTRIBUTING.md phpunit.dusk.xml phpunit.xml Vagrantfile
@@ -63,25 +61,25 @@ jobs:
6361
body_path: ./RELEASE_CHANGELOG
6462
draft: true
6563
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
66-
64+
6765
- name: Upload binary
6866
id: upload-release-archive
6967
uses: actions/upload-release-asset@v1
7068
env:
7169
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7270
with:
73-
upload_url: ${{ steps.create_release.outputs.upload_url }}
71+
upload_url: ${{ steps.create_release.outputs.upload_url }}
7472
asset_path: panel.tar.gz
7573
asset_name: panel.tar.gz
7674
asset_content_type: application/gzip
77-
75+
7876
- name: Upload checksum
79-
id: upload-release-checksum
77+
id: upload-release-checksum
8078
uses: actions/upload-release-asset@v1
8179
env:
8280
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8381
with:
84-
upload_url: ${{ steps.create_release.outputs.upload_url }}
82+
upload_url: ${{ steps.create_release.outputs.upload_url }}
8583
asset_path: ./checksum.txt
8684
asset_name: checksum.txt
8785
asset_content_type: text/plain

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: tests
1+
name: Run Test Suite
22
on:
33
push:
44
branch-ignore:

Dockerfile

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,39 @@
1-
FROM php:7.4-fpm-alpine
2-
1+
# Stage 0:
2+
# Build the assets that are needed for the frontend. This build stage is then discarded
3+
# since we won't need NodeJS anymore in the future. This Docker image ships a final production
4+
# level distribution of Pterodactyl.
5+
FROM mhart/alpine-node:14
36
WORKDIR /app
4-
5-
RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot yarn; \
6-
docker-php-ext-install bcmath; \
7-
docker-php-ext-install gd; \
8-
docker-php-ext-install mbstring; \
9-
docker-php-ext-install pdo; \
10-
docker-php-ext-install pdo_mysql; \
11-
docker-php-ext-install tokenizer; \
12-
docker-php-ext-install xml; \
13-
docker-php-ext-configure zip --with-libzip=/usr/include; \
14-
docker-php-ext-install zip; \
15-
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
16-
177
COPY . ./
8+
RUN yarn install --frozen-lockfile \
9+
&& yarn run build:production
1810

19-
RUN cp .env.example .env \
20-
&& composer install --no-dev --optimize-autoloader \
21-
&& rm .env \
22-
&& chown -R nginx:nginx . && chmod -R 777 storage/* bootstrap/cache
23-
24-
RUN cp docker/default.conf /etc/nginx/conf.d/default.conf \
25-
&& cat docker/www.conf > /usr/local/etc/php-fpm.d/www.conf \
26-
&& rm /usr/local/etc/php-fpm.d/www.conf.default \
27-
&& cat docker/supervisord.conf > /etc/supervisord.conf \
28-
&& echo "* * * * * /usr/local/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \
29-
&& sed -i s/ssl_session_cache/#ssl_session_cache/g /etc/nginx/nginx.conf \
30-
&& mkdir -p /var/run/php /var/run/nginx
11+
# Stage 1:
12+
# Build the actual container with all of the needed PHP dependencies that will run the application.
13+
FROM php:7.4-fpm-alpine
14+
WORKDIR /app
15+
COPY . ./
16+
COPY --from=0 /app/public/assets ./public/assets
17+
RUN apk add --no-cache --update ca-certificates dcron curl git supervisor tar unzip nginx libpng-dev libxml2-dev libzip-dev certbot \
18+
&& docker-php-ext-configure zip \
19+
&& docker-php-ext-install bcmath gd pdo_mysql zip \
20+
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
21+
&& cp .env.example .env \
22+
&& mkdir -p bootstrap/cache/ storage/logs storage/framework/sessions storage/framework/views storage/framework/cache \
23+
&& chmod 777 -R bootstrap storage \
24+
&& composer install --no-dev --optimize-autoloader \
25+
&& rm -rf .env bootstrap/cache/*.php \
26+
&& chown -R nginx:nginx .
27+
28+
RUN rm /usr/local/etc/php-fpm.d/www.conf.default \
29+
&& echo "* * * * * /usr/local/bin/php /app/artisan schedule:run >> /dev/null 2>&1" >> /var/spool/cron/crontabs/root \
30+
&& sed -i s/ssl_session_cache/#ssl_session_cache/g /etc/nginx/nginx.conf \
31+
&& mkdir -p /var/run/php /var/run/nginx
32+
33+
COPY .github/docker/default.conf /etc/nginx/conf.d/default.conf
34+
COPY .github/docker/www.conf /usr/local/etc/php-fpm.d/www.conf
35+
COPY .github/docker/supervisord.conf /etc/supervisord.conf
3136

3237
EXPOSE 80 443
33-
34-
ENTRYPOINT ["/bin/ash", "docker/entrypoint.sh"]
35-
38+
ENTRYPOINT ["/bin/ash", ".github/docker/entrypoint.sh"]
3639
CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ]

0 commit comments

Comments
 (0)