Skip to content

Commit

Permalink
Speed up Docker build and fix entrypoint permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoResonance committed Jan 8, 2025
1 parent a7a7c5b commit ac6739c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ ln -s /pelican-data/database/database.sqlite /var/www/html/database/

if ! grep -q "APP_KEY=" .env || grep -q "APP_KEY=$" .env; then
echo "Generating APP_KEY..."
php artisan key:generate --force
su -s /bin/ash -c "php artisan key:generate --force" www-data
else
echo "APP_KEY is already set."
fi

## make sure the db is set up
echo -e "Migrating Database"
php artisan migrate --force
su -s /bin/ash -c "php artisan migrate --force" www-data

echo -e "Optimizing Filament"
php artisan filament:optimize
su -s /bin/ash -c "php artisan filament:optimize" www-data

## start cronjobs for the queue
echo -e "Starting cron jobs."
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ FROM node:20-alpine AS yarn

WORKDIR /build

COPY . ./
COPY package.json yarn.lock ./

RUN yarn config set network-timeout 300000 \
&& yarn install --frozen-lockfile \
&& yarn run build:production
&& yarn install --frozen-lockfile

COPY . ./

RUN yarn run build:production

FROM php:8.3-fpm-alpine
# FROM --platform=$TARGETOS/$TARGETARCH php:8.3-fpm-alpine
Expand Down Expand Up @@ -49,7 +52,7 @@ RUN cp .github/docker/supervisord.conf /etc/supervisord.conf && \
mkdir /var/log/supervisord/

HEALTHCHECK --interval=5m --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost/up || exit 1
CMD curl -f http://localhost/up || exit 1

EXPOSE 80 443

Expand Down
2 changes: 2 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ x-common:
services:
panel:
image: ghcr.io/pelican-dev/panel:latest
build:
dockerfile: ./Dockerfile
restart: always
networks:
- default
Expand Down

0 comments on commit ac6739c

Please sign in to comment.