diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index e425f77..e9a3965 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/atas/ssg-builder:202310131336 + image: ghcr.io/atas/ssg-builder:202310141833 steps: - name: Checkout repository @@ -45,7 +45,7 @@ jobs: run: composer install --prefer-dist --no-progress - name: Run Ata's SSG HTML Builder - uses: atas/ssg-html-builder@2.1 + uses: atas/ssg-html-builder-action@2.1 with: less_file_path: 'assets/styles/style.less' diff --git a/Makefile b/Makefile index 8d94e66..eea21bb 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,5 @@ - -# You would only need to use these if you want to build your own custom builder image. -# Otherwise, by default the workflow uses the pre-built image from ghcr.io/atas/ssg-builder:latest - -.PHONY: build-local-image update-workflow-image run-local-image - -build-local-image: - docker build system/workflow-image -t atas-ssg-builder:latest - -run-local-image: - docker run --rm -it -v $(shell pwd):/workspace atas-ssg-builder:latest +.PHONY: dev-server dev-server: - docker run --rm -it --entrypoint /workspace/system/bin/dev-server-entrypoint.sh -p 8001:80 \ - -v $(shell pwd):/workspace atas-ssg-builder:latest - -# Updates the GHCR:latest image -update-workflow-image: - docker login ghcr.io - docker buildx build --platform linux/amd64 system/workflow-image -t ghcr.io/atas/ssg-builder:latest - docker push ghcr.io/atas/ssg-builder:latest - -# Creates a new tag for GHCR:latest image with the current date and time -tag-workflow-image: - docker tag ghcr.io/atas/ssg-builder:latest ghcr.io/atas/ssg-builder:$(shell date +%Y%m%d%H%M) - docker push ghcr.io/atas/ssg-builder:$(shell date +%Y%m%d%H%M) - + docker run --rm -it --entrypoint /dev-server-entrypoint.sh -p 8001:80 \ + -v $(shell pwd):/workspace ghcr.io/atas/ssg-builder:latest diff --git a/system/bin/dev-server-entrypoint.sh b/system/bin/dev-server-entrypoint.sh deleted file mode 100755 index 19a6490..0000000 --- a/system/bin/dev-server-entrypoint.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# Check if php-fpm is running -if ! pgrep "php-fpm" > /dev/null; then - php-fpm -D -fi - -# Check if nginx is running -if ! pgrep "nginx" > /dev/null; then - service nginx start -fi - -echo "Dev server should be running at http://localhost:8001 or any other port if you changed the default." - -tail -f /dev/null diff --git a/system/workflow-image/Dockerfile b/system/workflow-image/Dockerfile deleted file mode 100644 index b9129f0..0000000 --- a/system/workflow-image/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -# Set the base image to PHP 7.4 FPM -FROM php:8.2-fpm - -# Install some basic utilities and PHP extensions -RUN apt-get update && apt-get install -y \ - libpng-dev \ - libjpeg-dev \ - libfreetype6-dev \ - nginx \ - node-less \ - git \ - jq \ - procps \ - vim \ - && docker-php-ext-configure gd --with-freetype --with-jpeg - -# Remove default Nginx configuration -RUN rm -rf /etc/nginx/sites-available/default \ - && rm -rf /etc/nginx/sites-enabled/default - -# Copy a new Nginx configuration file into the container -COPY nginx.conf /etc/nginx/sites-available/site.conf -RUN ln -s /etc/nginx/sites-available/site.conf /etc/nginx/sites-enabled/ - -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/nginx-selfsigned.key -out /etc/nginx/nginx-selfsigned.crt -subj "/C=US/ST=SomeState/L=SomeCity/O=SomeOrganization/OU=SomeOrganizationalUnit/CN=somedomain.com" - -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - -RUN echo "alias ll='ls -lha'" >> /root/.bashrc - -LABEL org.opencontainers.image.source = "https://github.com/atas/ssg" - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/system/workflow-image/entrypoint.sh b/system/workflow-image/entrypoint.sh deleted file mode 100755 index 50d2c39..0000000 --- a/system/workflow-image/entrypoint.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -tail -f /dev/null - -exec "$@" diff --git a/system/workflow-image/nginx.conf b/system/workflow-image/nginx.conf deleted file mode 100644 index f126995..0000000 --- a/system/workflow-image/nginx.conf +++ /dev/null @@ -1,78 +0,0 @@ -server { - # We want ssl during build process to mitigate GitHub Pages so links are correct. - listen 443 ssl; - - ssl_certificate /etc/nginx/nginx-selfsigned.crt; - ssl_certificate_key /etc/nginx/nginx-selfsigned.key; - - root /workspace; - index index.php index.html; - - error_page 404 /404.php; - - location ~ ^/p/(.+)$ { - rewrite ^/p/(.+)$ /post.php?slug=$1 last; - } - - location / { - # If matching .php file found, rewrite to that, e.g. custom-page.php for /custom-page - if (-f $request_filename.php) { - rewrite ^(.*)$ $1.php last; - } - - try_files $uri $uri.html $uri/ @try-render-page; - index index.html index.htm index.php; - } - - location @try-render-page { - rewrite ^/([a-zA-Z0-9-]+)$ /page.php?page=$1 last; - } - - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass 127.0.0.1:9000; # assuming PHP-FPM is running on this address - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - } - -} - -server { - listen 80; - - root /workspace; - index index.php index.html; - - error_page 404 /404.php; - - location ~ ^/p/(.+)$ { - rewrite ^/p/(.+)$ /post.php?slug=$1 last; - } - - location / { - # If matching .php file found, rewrite to that, e.g. custom-page.php for /custom-page - if (-f $request_filename.php) { - rewrite ^(.*)$ $1.php last; - } - - try_files $uri $uri.html $uri/ @try-render-page; - index index.html index.htm index.php; - } - - location @try-render-page { - rewrite ^/([a-zA-Z0-9-]+)$ /page.php?page=$1 last; - } - - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass 127.0.0.1:9000; # assuming PHP-FPM is running on this address - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - } -}