diff --git a/.env.example b/.env.example index 321fce2..42b26e1 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ DOCKER_IMAGE_TAG=codebarista/octane:latest DOCKER_PLATFORM=linux/amd64,linux/arm64 +DOCKER_LOCAL_PLATFORM=linux/arm64 DOCKER_REGISTRY=docker.io diff --git a/.gitignore b/.gitignore index d5dab26..80b3937 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_STORE +.env # Intellij .idea diff --git a/README.md b/README.md index 8760f5e..83d8681 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Docker Octane [![Deploy Octane Image](https://github.com/codebarista/docker-octane/actions/workflows/main.yml/badge.svg)](https://github.com/codebarista/docker-octane/actions/workflows/main.yml) -Latest PHP Alpine Docker image to run Laravel Octane with Swoole or FrankenPHP +Latest PHP Alpine Docker image to run Laravel Octane with Swoole or FrankenPHP. ## Setup @@ -14,17 +14,18 @@ brew install go-task ## Config -Rename `.env.example` and set env vars +Copy `.env.example` to `.env` and set your env vars: ```dotenv DOCKER_IMAGE_TAG=codebarista/octane:latest DOCKER_PLATFORM=linux/amd64,linux/arm64 +DOCKER_LOCAL_PLATFORM=linux/arm64 DOCKER_REGISTRY=docker.io ``` ## Load -Build and load image to local registry +Build and load image to local registry. ```shell task load @@ -32,7 +33,7 @@ task load ## Push -Build and push image to docker registry +Build and push image to remote registry. ```shell task push @@ -40,7 +41,7 @@ task push ## Fork -Fork and set GitHub secrets for custom push on push. +Fork and set GitHub secrets for custom push. ```dotenv DOCKERHUB_USERNAME diff --git a/Taskfile.yml b/Taskfile.yml index e65167e..69100a1 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -2,6 +2,8 @@ version: 3 silent: true +dotenv: ['.env'] + env: LOCAL_PLATFORM: '{{.DOCKER_LOCAL_PLATFORM | default "linux/arm64"}}' PLATFORM: '{{.DOCKER_PLATFORM | default "linux/amd64,linux/arm64"}}' @@ -31,6 +33,7 @@ tasks: - task: login - task: build vars: + PLATFORM: '{{.PLATFORM}}' OUTPUT: type=registry --push load: @@ -38,7 +41,7 @@ tasks: cmds: - task: build vars: - PLATFORM: linux/arm64 + PLATFORM: '{{.LOCAL_PLATFORM}}' OUTPUT: type=docker --load prune: @@ -46,7 +49,7 @@ tasks: cmd: docker image prune --force --filter=dangling=true clear: - desc: Remove buildx container after failed build + desc: Remove buildx container cmd: docker buildx rm container run: diff --git a/src/Dockerfile b/src/Dockerfile index a32f73e..ad0cff4 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,7 +1,7 @@ FROM php:alpine ARG INSTALLER_BASE_URL="https://github.com/mlocati/docker-php-extension-installer/releases" -ARG SCHEDULE_CRONTAB="* * * * * /usr/local/bin/php /var/www/artisan schedule:run" +ARG SCHEDULE_CRONTAB="* * * * * cd /var/www && php artisan schedule:run >> /dev/null 2>&1" ADD $INSTALLER_BASE_URL/latest/download/install-php-extensions /usr/local/bin/