Files
panel/Dockerfile

61 lines
1.6 KiB
Docker
Raw Normal View History

2024-06-02 21:57:23 -04:00
# Pelican Production Dockerfile
FROM node:20-alpine AS yarn
#FROM --platform=$TARGETOS/$TARGETARCH node:20-alpine AS yarn
2024-06-11 19:17:48 -04:00
WORKDIR /build
2024-06-02 21:57:23 -04:00
COPY . ./
2024-06-11 19:17:48 -04:00
RUN yarn install --frozen-lockfile && yarn run build:production
2024-06-02 21:57:23 -04:00
FROM php:8.3-fpm-alpine
# FROM --platform=$TARGETOS/$TARGETARCH php:8.3-fpm-alpine
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
WORKDIR /var/www/html
# Install dependencies
RUN apk update && apk add --no-cache \
2024-06-11 19:17:48 -04:00
libpng-dev libjpeg-turbo-dev freetype-dev libzip-dev icu-dev \
zip unzip curl \
caddy ca-certificates supervisor \
2024-09-27 15:33:18 -04:00
&& docker-php-ext-install bcmath gd intl zip opcache pcntl posix pdo_mysql
2024-06-02 21:57:23 -04:00
# Copy the Caddyfile to the container
COPY Caddyfile /etc/caddy/Caddyfile
2024-06-02 21:57:23 -04:00
# Copy the application code to the container
COPY . .
2024-06-11 19:17:48 -04:00
COPY --from=yarn /build/public/assets ./public/assets
2024-06-02 21:57:23 -04:00
2024-09-27 15:53:44 -04:00
RUN touch .env
2024-06-02 21:57:23 -04:00
RUN composer install --no-dev --optimize-autoloader
# Set file permissions
2024-06-11 19:17:48 -04:00
RUN chmod -R 755 /var/www/html/storage \
2024-06-02 21:57:23 -04:00
&& chmod -R 755 /var/www/html/bootstrap/cache
2024-09-27 16:50:34 -04:00
# Add scheduler to cron
RUN echo "* * * * * php /var/www/html/artisan schedule:run >> /dev/null 2>&1" | crontab -u www-data -
# Create new service for the queue
RUN php artisan p:environment:queue-service --service-name=pelican-queue --user=www-data --group=www-data --overwrite
2024-06-02 21:57:23 -04:00
2024-06-11 19:17:48 -04:00
HEALTHCHECK --interval=5m --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost/up || exit 1
EXPOSE 80:2019
EXPOSE 443
2024-06-11 19:17:48 -04:00
VOLUME /pelican-data
2024-06-02 21:57:23 -04:00
# Start PHP-FPM
CMD ["sh", "-c", "php-fpm"]
2024-06-02 21:57:23 -04:00
ENTRYPOINT [ "/bin/ash", ".github/docker/entrypoint.sh" ]
# CMD [ "supervisord", "-n", "-c", "/etc/supervisord.conf" ]