generated from thegrind/laravel-dockerized
Initial commit
This commit is contained in:
commit
274975dbe9
35
.dockerignore
Normal file
35
.dockerignore
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
.env
|
||||||
|
.env.example
|
||||||
|
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
/public/hot
|
||||||
|
/public/storage
|
||||||
|
/storage/*.key
|
||||||
|
|
||||||
|
# Logs and cache
|
||||||
|
*.log
|
||||||
|
/storage/logs/*
|
||||||
|
/storage/framework/cache/*
|
||||||
|
/storage/framework/sessions/*
|
||||||
|
/storage/framework/testing/*
|
||||||
|
/storage/framework/views/*
|
||||||
|
/storage/app/public/*
|
||||||
|
/storage/app/private/*
|
||||||
|
/bootstrap/cache/*.php
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
# Docker itself
|
||||||
|
docker-compose.yml
|
||||||
|
Dockerfile
|
||||||
|
.dockerignore
|
||||||
|
|
||||||
|
/database/*.sqlite
|
||||||
|
/database/*.db
|
52
.github/workflows/build.yml
vendored
Normal file
52
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
name: Build & Push Docker Image to Registry
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '24'
|
||||||
|
|
||||||
|
- name: Set up PHP with Composer
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '8.4'
|
||||||
|
tools: composer:v2
|
||||||
|
|
||||||
|
- name: Install PHP dependencies
|
||||||
|
run: composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
|
- name: Install JS dependencies and build assets
|
||||||
|
run: |
|
||||||
|
npm ci
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Gitea Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gitgud.foo
|
||||||
|
username: docker_registry_pusher
|
||||||
|
password: ${{ secrets.DOCKER_USER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: ${{ github.workspace }}
|
||||||
|
file: ${{ github.workspace }}/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
gitgud.foo/thegrind/flowtodo:latest
|
||||||
|
gitgud.foo/thegrind/flowtodo:${{ github.event.release.tag_name }}
|
4
Dockerfile
Normal file
4
Dockerfile
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
FROM gitgud.foo/thegrind/laravel-base:latest
|
||||||
|
|
||||||
|
# Get the app in there
|
||||||
|
COPY . /app
|
33
Makefile
Normal file
33
Makefile
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
IMAGE_NAME = laravel-app
|
||||||
|
CONTAINER_NAME = laravel-app
|
||||||
|
PORT = 8889
|
||||||
|
VERSION = "latest"
|
||||||
|
|
||||||
|
.PHONY: build run rebuild
|
||||||
|
|
||||||
|
# Make sure to get set up with octane and frankenPHP
|
||||||
|
# since that's what the base docker image expects
|
||||||
|
setup:
|
||||||
|
composer require laravel/octane
|
||||||
|
php artisan octane:install --server=frankenphp
|
||||||
|
|
||||||
|
# Build the Docker image
|
||||||
|
build:
|
||||||
|
npm run build
|
||||||
|
docker build -t $(IMAGE_NAME) .
|
||||||
|
|
||||||
|
# Run the container
|
||||||
|
run:
|
||||||
|
docker run -it --rm -p $(PORT):8000 -e APP_DEBUG=true --name $(CONTAINER_NAME) $(IMAGE_NAME)
|
||||||
|
|
||||||
|
# Rebuild (force rebuild without cache)
|
||||||
|
rebuild:
|
||||||
|
docker build --no-cache -t $(IMAGE_NAME) .
|
||||||
|
|
||||||
|
docker-publish:
|
||||||
|
docker image tag flowtodo:latest gitgud.foo/thegrind/flowtodo:$(VERSION)
|
||||||
|
docker push gitgud.foo/thegrind/flowtodo:$(VERSION)
|
||||||
|
|
||||||
|
test-remote-image:
|
||||||
|
docker pull gitgud.foo/thegrind/flowtodo:latest
|
||||||
|
docker run --rm -p 8889:8000 gitgud.foo/thegrind/flowtodo:latest
|
19
README.md
Normal file
19
README.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Laravel Dockerized
|
||||||
|
|
||||||
|
This repo just includes the necessary files to quickly set up a laravel
|
||||||
|
app to be dockerized and released for self hosting. All you have to
|
||||||
|
do when you start a new app is start the repo from this template
|
||||||
|
and merge these files with your existing app.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
### Install octane
|
||||||
|
|
||||||
|
`composer require laravel/octane`
|
||||||
|
`php artisan octane:install`
|
||||||
|
|
||||||
|
Once you started your laravel project **and** initialized it as a git repo:
|
||||||
|
|
||||||
|
1. `git remote add origin git@gitgud.foo:thegrind/laravel-dockerized.git`
|
||||||
|
2. `git pull -u origin main`
|
||||||
|
3. Run `make setup` to install laravel octane with FrankenPHP since this is what the `laravel-base` image expects from your app.
|
Loading…
x
Reference in New Issue
Block a user