61 Commits
v1 ... v2

Author SHA1 Message Date
cbd06482f4 switch base container from ubuntu to php-alpine (#9)
Some checks failed
ci/woodpecker/manual/build_release/1 Pipeline failed
ci/woodpecker/manual/build_release/2 Pipeline failed
ci/woodpecker/manual/build_release/3 Pipeline failed
ci/woodpecker/manual/build_release/4 Pipeline failed
Co-authored-by: Ruben Momoa <ruben.lobbes@lobbes.nl>
Reviewed-on: #9
2024-08-23 15:54:47 +02:00
Ruben Momoa
6f648c4ebd fix: dev build step
All checks were successful
ci/woodpecker/manual/build Pipeline was successful
ci/woodpecker/cron/build Pipeline was successful
2024-08-20 15:04:48 +02:00
Ruben Momoa
496f349073 exclude master branch 2024-08-20 15:03:24 +02:00
Ruben Momoa
4dc2c625b5 just use CI_COMMIT_BRANCH for dev builds 2024-08-20 14:57:07 +02:00
Ruben Momoa
3609df566d Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	.woodpecker/build.yml
2024-08-20 14:56:07 +02:00
Ruben Momoa
8d116129ff add dev build 2024-08-20 14:55:39 +02:00
Ruben Momoa
db47dddbf9 add dev build
Some checks failed
ci/woodpecker/manual/build Pipeline failed
2024-08-20 14:53:55 +02:00
Ruben Momoa
40c9fce6d8 clear apt cache 2024-08-20 14:44:04 +02:00
Ruben Momoa
b274e3f91d temp
All checks were successful
ci/woodpecker/manual/build Pipeline was successful
2024-08-20 14:36:12 +02:00
Ruben Momoa
369e9e9c0d revert temp changes and fix error
Some checks failed
ci/woodpecker/manual/build Pipeline failed
2024-08-20 14:34:22 +02:00
Ruben Momoa
6550f811ea temp
Some checks failed
ci/woodpecker/manual/build Pipeline failed
2024-08-20 14:30:02 +02:00
Ruben Momoa
2b688a1521 temp
Some checks failed
ci/woodpecker/manual/build Pipeline failed
2024-08-20 14:29:06 +02:00
Ruben Momoa
5661689b2b temp
Some checks failed
ci/woodpecker/manual/build Pipeline failed
2024-08-20 14:21:31 +02:00
Ruben Momoa
efbbad801c temp
Some checks failed
ci/woodpecker/manual/build Pipeline failed
2024-08-20 14:16:06 +02:00
Ruben Momoa
34000c324a temp
Some checks failed
ci/woodpecker/manual/build Pipeline failed
2024-08-20 14:14:16 +02:00
Ruben Momoa
f477835dc3 temp
Some checks failed
ci/woodpecker/manual/build Pipeline failed
2024-08-20 14:12:55 +02:00
Ruben Momoa
66c1c339d0 update
Some checks failed
ci/woodpecker/manual/build Pipeline failed
2024-08-20 14:10:45 +02:00
Ruben Momoa
36208b9380 update
Some checks failed
ci/woodpecker/manual/build Pipeline failed
2024-08-20 14:09:22 +02:00
Ruben Momoa
f464938a74 update
All checks were successful
ci/woodpecker/manual/build Pipeline was successful
2024-08-20 14:07:02 +02:00
vista
e32314b0fb update submodules [skip ci]
Some checks failed
ci/woodpecker/cron/build Pipeline failed
2024-03-31 01:19:13 +00:00
ac03fea565 Merge pull request 'Update .woodpecker/build.yml' (#8) from dev into master
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/tag/build-dev Pipeline was successful
ci/woodpecker/tag/build Pipeline was successful
Pipeline failed
ci/woodpecker/manual/build Pipeline was successful
ci/woodpecker/cron/build Pipeline failed
Reviewed-on: #8
2023-08-24 23:05:47 +02:00
eca9f58ded Update .woodpecker/build.yml
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
2023-08-24 23:05:32 +02:00
2c4ba8701d Merge pull request 'Update build/start-container.sh' (#7) from dev into master
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/tag/build Pipeline failed
ci/woodpecker/tag/build-dev Pipeline was successful
Reviewed-on: #7
2023-08-24 22:59:04 +02:00
9052ef6ccd Update build/start-container.sh
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
2023-08-24 22:50:52 +02:00
c30aa78354 Merge pull request 'dev' (#6) from dev into master
All checks were successful
ci/woodpecker/push/build Pipeline was successful
Reviewed-on: #6
2023-08-24 22:35:40 +02:00
f9bbc871ae Update Dockerfile
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
2023-08-24 22:23:57 +02:00
11a2559fd7 Update Dockerfile
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-08-24 22:17:51 +02:00
3a232eeb9e Update Dockerfile
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-08-24 22:13:39 +02:00
fb225cfeaf Update .woodpecker/build-dev.yaml
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-08-24 21:47:45 +02:00
19a72aa415 Update Dockerfile
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-08-24 21:47:37 +02:00
c50ef69480 Update .woodpecker/build-dev.yaml
Some checks failed
ci/woodpecker/push/build-dev Pipeline failed
2023-08-24 21:46:54 +02:00
5982495722 Update Dockerfile
Some checks failed
ci/woodpecker/push/build-dev Pipeline failed
2023-08-24 21:45:45 +02:00
vista
dcc02b3e88 update submodules [skip ci] 2023-08-24 19:40:49 +00:00
34e14034c3 Update .woodpecker/build-dev.yaml
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-08-24 21:40:43 +02:00
e0ee5eb9a8 testing updating the module
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-08-24 21:38:08 +02:00
95d84f8660 Update .woodpecker/build-dev.yaml
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-08-24 21:26:20 +02:00
58bda2df32 Merge pull request 'master' (#5) from master into dev
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
Reviewed-on: #5
2023-08-24 21:23:08 +02:00
29c690d454 add artisan-bash-completion submodule
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/pr/build-dev Pipeline was successful
2023-08-24 21:22:05 +02:00
fe18131363 Update Dockerfile
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-08-24 17:11:19 +02:00
7c64072192 Add Readme.md
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-08-21 11:52:30 +02:00
26f65e7f15 Merge pull request 'Update .woodpecker/build-dev.yaml' (#4) from dev into master
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/cron/build Pipeline failed
Reviewed-on: #4
2023-08-17 17:15:10 +02:00
309d7d148e Update .woodpecker/build-dev.yaml
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
2023-08-17 17:14:53 +02:00
21adddf19a Merge pull request 'dev' (#3) from dev into master
Reviewed-on: #3
2023-08-17 17:13:49 +02:00
Ruben Momoa
b3c1952e9d Merge branch 'dev'
# Conflicts:
#	.woodpecker/build-dev.yaml
#	.woodpecker/build.yml
#	build/start-container.sh
2023-08-17 17:13:12 +02:00
129af47626 Update build/start-container.sh
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-08-15 14:49:07 +02:00
e5a0cde614 Update .woodpecker/build-dev.yaml
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
2023-08-15 14:41:21 +02:00
a35ae28a21 Update .woodpecker/build.yml 2023-08-15 14:41:14 +02:00
fef9baec62 Update 'Dockerfile'
All checks were successful
ci/woodpecker/pr/build Pipeline was successful
[SKIP CI]
2023-03-16 13:49:39 +01:00
5870025017 Update 'build/start-container.sh'
[SKIP CI]
2023-03-16 13:49:21 +01:00
1ca34319c8 fix trailing \
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-03-16 13:36:17 +01:00
aaf97839f8 Update 'build/start-container'
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
2023-03-16 13:27:20 +01:00
3c8b1f42c5 Update '.woodpecker/build-dev.yaml'
[skip ci]
2023-03-16 13:25:16 +01:00
f49d94041f Update '.woodpecker/build.yml'
[skip ci]
2023-03-16 13:24:54 +01:00
ff8d6f4390 Add '.woodpecker/build-dev.yaml'
All checks were successful
ci/woodpecker/push/build-dev Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
2023-03-16 13:17:38 +01:00
81a41040bb Update '.woodpecker/build.yml'
All checks were successful
ci/woodpecker/push/build Pipeline was successful
2023-03-16 13:15:50 +01:00
05c1afb8e5 fix
All checks were successful
ci/woodpecker/push/build Pipeline was successful
2023-03-16 13:13:29 +01:00
8649b86743 move Dockerfile
Some checks failed
ci/woodpecker/push/build Pipeline failed
2023-03-16 13:12:34 +01:00
ac363dccb7 move docker file
[SKIP CI]
2023-03-16 13:12:08 +01:00
14df49cd45 Update 'build/Dockerfile'
Some checks failed
ci/woodpecker/push/build Pipeline failed
2023-03-16 13:11:40 +01:00
6c17d233d8 Update 'build/start-container'
[skip ci]
2023-03-16 13:02:22 +01:00
48160fd97d Update 'build/start-container.sh'
[skip ci]
2023-03-16 13:02:08 +01:00
9 changed files with 172 additions and 136 deletions

View File

@@ -1,19 +0,0 @@
# the laravel version to install (empty for latest)
LARAVEL_VERSION=
# weather to run "npm dev run" at boot
AUTO_START_NPM_DEV=true
# external ports
FORWARD_LARAVEL_PORT=80
FORWARD_VITE_PORT=5173
FORWARD_DB_PORT=3306
FORWARD_REDIS_PORT=6379
FORWARD_MAILPIT_PORT=1025
FORWARD_MAILPIT_DASHBOARD_PORT=8025
# DB settings (this will overwrite the defaults in the laravel project)
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=password

View File

@@ -1,30 +0,0 @@
when:
branch: dev
pipeline:
check_base:
image: vistanarvas/container-update-checker:latest
secrets:
- source: dockerhub_token
target: docker_password
environment:
DOCKER_USERNAME: vistanarvas
BASE: ubuntu:latest
TARGET: vistanarvas/${CI_REPO_NAME}:latest
when:
cron: nightly
event: cron
build_and_publish:
image: woodpeckerci/plugin-docker-buildx
settings:
username: vistanarvas
password:
from_secret: DOCKERHUB_TOKEN
context: ./build
repo: vistanarvas/${CI_REPO_NAME}
tag: dev
when:
path:
include: [ '.woodpecker/build-dev.yaml', 'build/*', 'Dockerfile' ]
cron: nightly
event: [push, cron, manual]

View File

@@ -1,30 +0,0 @@
when:
branch: master
pipeline:
check_base:
image: vistanarvas/container-update-checker:latest
secrets:
- source: dockerhub_token
target: docker_password
environment:
DOCKER_USERNAME: vistanarvas
BASE: ubuntu:latest
TARGET: vistanarvas/${CI_REPO_NAME}:latest
when:
cron: nightly
event: cron
build_and_publish:
image: woodpeckerci/plugin-docker-buildx
settings:
username: vistanarvas
password:
from_secret: DOCKERHUB_TOKEN
context: ./build
repo: vistanarvas/${CI_REPO_NAME}
auto_tag: true
when:
path:
include: [ '.woodpecker/build.yml', 'build/*', 'Dockerfile' ]
cron: nightly
event: [push, tag, deployment, cron, manual]

23
.woodpecker/build_dev.yml Normal file
View File

@@ -0,0 +1,23 @@
matrix:
PHP_VERSION:
- 8
when:
branch:
exclude: [ main, master ]
path:
include: [ '.woodpecker/build_dev.yml', 'build/*', 'Dockerfile' ]
event: [ push, manual ]
steps:
dev_alpine_build_and_publish:
image: woodpeckerci/plugin-docker-buildx
settings:
username: vistanarvas
password:
from_secret: DOCKERHUB_TOKEN
context: ./build
repo: vistanarvas/${CI_REPO_NAME}
tag: test-${CI_COMMIT_BRANCH}-php-${PHP_VERSION}
build_args:
- BASE_VERSION=${PHP_VERSION}

View File

@@ -0,0 +1,40 @@
matrix:
PHP_VERSION:
- 8
- 8.3
- 8.2
- 8.1
when:
branch:
include: [ master ]
cron: nightly
event: [ cron, release, manual ]
steps:
cron_pre_check:
image: docker
commands:
- docker pull php:${PHP_VERSION}-fpm-alpine
- docker pull vistanarvas/simple-laravel:${PHP_VERSION}-fpm-alpine
- BASE_IMG=$(docker inspect php:${PHP_VERSION}-fpm-alpine --format='{{.Created}}' | cut -d '.' -f 1)
- PREV_IMG=$(docker inspect vistanarvas/simple-laravel:php-${PHP_VERSION} --format='{{.Created}}' | cut -d '.' -f 1)
- BASE_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$BASE_IMG" +%s)
- PREV_DATE=$(date -D "%Y-%m-%dT%H:%M:%S" -d "$PREV_IMG" +%s)
- if [ "$PREV_DATE" -gt "$BASE_DATE" ]; then echo "no rebuild needed"; exit 1; fi
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
cron: nightly
event: [ cron ]
release_alpine_build_and_publish:
image: woodpeckerci/plugin-docker-buildx
settings:
username: vistanarvas
password:
from_secret: DOCKERHUB_TOKEN
context: ./build
repo: vistanarvas/${CI_REPO_NAME}
auto_tag: true
auto_tag_suffix: -php-${PHP_VERSION}

View File

@@ -1,41 +1,37 @@
FROM ubuntu:latest
ARG BASE_VERSION
ARG USERNAME=laravel
ARG USER_UID=1000
ARG NODE_VERSION='' # node version number like "12.22.1" or empty for the latest version
ARG COMPOSER_VERSION='' # composer version number like "2.1" or empty for the latest version
FROM php:${BASE_VERSION}-fpm-alpine
ENV NVM_DIR="/home/$USERNAME/.nvm"
# port to for the webserver
ENV WEBSERVER_PORT=8080
COPY start-container.sh /usr/local/bin/start-container
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y update \
&& apt-get install -y curl git 7zip php php-xml php-curl php-xml php-mbstring php-mysql \
&& useradd --create-home --uid=$USER_UID $USERNAME \
&& chmod +x /usr/local/bin/start-container \
&& echo "install composer" \
&& curl -o composer-setup.php https://getcomposer.org/installer \
&& curl -o composer-setup.sig https://composer.github.io/installer.sig \
&& echo " composer-setup.php" >> composer-setup.sig \
&& sha384sum -c composer-setup.sig \
&& if [ -n "$COMPOSER_VERSION" ]; then COMPOSER_VERSION="--${COMPOSER_VERSION}"; fi \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer $COMPOSER_VERSION \
&& rm composer-setup.php composer-setup.sig /var/www/html/* \
&& chown $USERNAME:$USERNAME /var/www/html
RUN apk add --no-cache \
curl-dev \
libxml2-dev \
oniguruma-dev \
libpng-dev \
icu-dev \
php-ctype \
php-curl \
php-dom \
php-fileinfo \
php-mbstring \
php-session \
php-xml \
php-intl \
php-bcmath \
php-exif \
php-xmlwriter \
php-tokenizer \
composer \
npm \
&& docker-php-ext-install filter pdo_mysql \
&& chmod +x /usr/local/bin/start-container
EXPOSE 8080
EXPOSE ${WEBSERVER_PORT}
WORKDIR /var/www/html
USER $USERNAME
RUN echo "install nvm and node" \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \
&& if [ -z "$NODE_VERSION" ]; then NODE_VERSION="node"; fi \
&& echo "source $NVM_DIR/nvm.sh" >> /home/$USERNAME/.bashrc \
&& [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION
ENTRYPOINT ["start-container"]

36
Readme.md Normal file
View File

@@ -0,0 +1,36 @@
# simple-laravel
## setting laravel up in a container
### vite
edit `/vite.config.js`
```diff
import laravel from 'laravel-vite-plugin';
export default defineConfig({
+ server: {
+ hmr: {
+ host: '[Server Domain or IP]'
+ },
+ },
plugins: [
laravel({
input: [
```
edit `/package.json`
```diff
"private": true,
"type": "module",
"scripts": {
- "dev": "vite",
+ "dev": "vite --host 0.0.0.0",
"build": "vite build"
},
"devDependencies": {
```

View File

@@ -1,25 +1,40 @@
#!/usr/bin/env bash
#!/usr/bin/env ash
# exit when any command fails
set -e
# init nvm
\. $NVM_DIR/nvm.sh
# install extra packages and extensions on first boot
if [[ ! -f /etc/first_boot ]]; then
if [[ -n "${EXTRA_APK_PACKAGES// /}" ]]; then
# shellcheck disable=SC2086
apk add --no-cache $EXTRA_APK_PACKAGES
fi
if [[ -n "${EXTRA_PHP_EXTENSIONS// /}" ]]; then
# shellcheck disable=SC2086
docker-php-ext-install $EXTRA_PHP_EXTENSIONS
fi
touch /etc/first_boot
fi
if [[ "$BOOT_COMPOSER_INSTALL" = true ]]; then
echo "composer install"
composer install
fi
if [[ "$BOOT_NPM_INSTALL" = true ]]; then
echo "npm install"
npm install
fi
if [ ! -f /var/www/html/artisan ]; then
echo "No existing Laravel project found"
composer create-project laravel/laravel /var/www/html "$LARAVEL_VERSION"
npm install -D tailwindcss postcss autoprefixer --prefix /var/www/html
sed -i "/export default defineConfig({/a\ server: {host: '0.0.0.0'}," /var/www/html/vite.config.js
echo -e "@tailwind base;\n@tailwind components;\n@tailwind utilities;" >> /var/www/html/resources/css/app.css
echo -e '/** @type {import('tailwindcss').Config} */\nmodule.exports = {\n content: [\n "./resources/**/*.blade.php",\n "./resources/**/*.js",\n "./resources/**/*.vue",\n ],\n theme: {\n extend: {},\n },\n plugins: [],\n}' > /var/www/html/tailwind.config.js
npx tailwindcss init -p
exit
fi
if [[ "$AUTO_START_NPM_DEV" = true ]]; then
if [[ "$BOOT_NPM_DEV" = true ]]; then
echo "Staring npm dev"
npm run dev --prefix /var/www/html &
fi
echo "Staring Laravel"
php /var/www/html/artisan serve --host=0.0.0.0 --port=8080
php /var/www/html/artisan serve --host=0.0.0.0 --port="$WEBSERVER_PORT"

View File

@@ -1,20 +1,25 @@
version: '3'
services:
app:
build:
context: build
dockerfile: Dockerfile
image: laravel
image: vistanarvas/simple-laravel
ports:
- '${FORWARD_LARAVEL_PORT:-80}:8080'
- '${FORWARD_VITE_PORT:-5173}:5173'
- '8080:80'
- '5173:5173'
environment:
LARAVEL_VERSION: '${LARAVEL_VERSION}'
AUTO_START_NPM_DEV: '${AUTO_START_NPM_DEV:-false}'
DB_HOST: mysql
WEBSERVER_PORT: 80
DB_CONNECTION: mysql
env_file:
.env
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: laravel
DB_USERNAME: laravel
DB_PASSWORD: password
BOOT_NPM_DEV: true # also starts `npm dev`
BOOT_NPM_INSTALL: true # runs `npm install` on boot
BOOT_COMPOSER_INSTALL: true # runs `composer install` on boot
# Extra packages and php extensions to install on first boot
# EXTRA_APK_PACKAGES: # example: libpng-dev icu-dev
# EXTRA_PHP_EXTENSIONS: # example: exif intl bcmath gd pdo_mysql
depends_on:
- mysql
- redis
@@ -23,7 +28,7 @@ services:
mysql:
image: 'mysql/mysql-server:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
- '3306:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: '%'
@@ -37,15 +42,15 @@ services:
redis:
image: 'redis:alpine'
ports:
- '${FORWARD_REDIS_PORT:-6379}:6379'
- '6379:6379'
volumes:
- 'redis:/data'
mailpit:
image: 'axllent/mailpit:latest'
ports:
- '${FORWARD_MAILPIT_PORT:-1025}:1025'
- '${FORWARD_MAILPIT_DASHBOARD_PORT:-8025}:8025'
- '1025:1025'
- '8025:8025'
volumes:
mysql: