Skip to content

Commit

Permalink
Edit cron and optimize local build task
Browse files Browse the repository at this point in the history
  • Loading branch information
codebarista committed Apr 16, 2024
1 parent 376d87d commit 3776517
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_STORE
.env

# Intellij
.idea
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,33 +14,34 @@ 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
```

## Push

Build and push image to docker registry
Build and push image to remote registry.

```shell
task push
```

## Fork

Fork and set GitHub secrets for custom push on push.
Fork and set GitHub secrets for custom push.

```dotenv
DOCKERHUB_USERNAME
Expand Down
7 changes: 5 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}'
Expand Down Expand Up @@ -31,22 +33,23 @@ tasks:
- task: login
- task: build
vars:
PLATFORM: '{{.PLATFORM}}'
OUTPUT: type=registry --push

load:
desc: Build and load image to local docker
cmds:
- task: build
vars:
PLATFORM: linux/arm64
PLATFORM: '{{.LOCAL_PLATFORM}}'
OUTPUT: type=docker --load

prune:
desc: Prune dangling images
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:
Expand Down
2 changes: 1 addition & 1 deletion src/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/

Expand Down

0 comments on commit 3776517

Please sign in to comment.