feat: correct way for nightly docker builds from source
This commit is contained in:
parent
849766ce8f
commit
78e42f59a9
2 changed files with 105 additions and 0 deletions
42
.github/workflows/nightly.yml
vendored
Normal file
42
.github/workflows/nightly.yml
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
name: Nightly / Build and publish a Docker image
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: acaslab/pterodactyl-panel
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 4 * * *'
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.nightly
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
63
Dockerfile.nightly
Normal file
63
Dockerfile.nightly
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
FROM ubuntu:22.04 as base
|
||||
|
||||
RUN apt update && apt -y install \
|
||||
software-properties-common \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
gnupg \
|
||||
curl
|
||||
|
||||
# Add Ondrej Sury's PPA for PHP
|
||||
RUN LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php \
|
||||
&& apt update
|
||||
|
||||
# Install PHP 8.1
|
||||
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt -y install \
|
||||
php8.1 \
|
||||
php8.1-common \
|
||||
php8.1-cli \
|
||||
php8.1-gd \
|
||||
php8.1-mysql \
|
||||
php8.1-mbstring \
|
||||
php8.1-bcmath \
|
||||
php8.1-xml \
|
||||
php8.1-fpm \
|
||||
php8.1-curl \
|
||||
php8.1-zip \
|
||||
unzip \
|
||||
tar \
|
||||
git
|
||||
|
||||
FROM base as builder
|
||||
|
||||
# Add Node.js 18.x PPA
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | sh -
|
||||
|
||||
# Install Node.js & Yarn to build assets
|
||||
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install nodejs -y && npm i -g yarn
|
||||
|
||||
RUN rm -rf /var/lib/apt && \
|
||||
rm -rf /var/lib/dpkg && \
|
||||
rm -rf /var/lib/cache && \
|
||||
rm -rf /var/lib/log
|
||||
|
||||
# Install composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
# Download the Pterodactyl Panel
|
||||
RUN git clone https://github.com/pterodactyl/panel.git /var/www/pterodactyl
|
||||
|
||||
WORKDIR /var/www/pterodactyl
|
||||
|
||||
# Install Node.js dependencies & build assets
|
||||
RUN yarn install --frozen-lockfile && yarn run build
|
||||
|
||||
# Install PHP dependencies
|
||||
RUN composer install --no-dev --optimize-autoloader
|
||||
|
||||
FROM base as app
|
||||
|
||||
WORKDIR /var/www/pterodactyl
|
||||
USER www-data
|
||||
|
||||
COPY --from=builder --chown=www-data:www-data /var/www/pterodactyl /var/www/pterodactyl
|
||||
Reference in a new issue