20 Commits
v1.1.0 ... 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
10 changed files with 131 additions and 173 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

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "build/submodules/artisan-bash-completion"]
path = build/submodules/artisan-bash-completion
url = https://gitlab.com/balping/artisan-bash-completion.git

View File

@@ -1,45 +0,0 @@
when:
branch: dev
steps:
update_submodule:
image: woodpeckerci/plugin-git
secrets:
- source: gitea_token
target: GITEA_TOKEN
- source: gitea_user
target: GITEA_USER
commands:
- git submodule update --remote
- if [ ! "$(git status --porcelain)" ]; then echo "no changes"; exit 0; fi
- git config user.name "$${GITEA_USER}"
- git config user.email "$${GITEA_USER}.gitea@narvas.tech"
- git add -A
- git commit -m "update submodules [skip ci]"
- git push "https://$${GITEA_USER}:$${GITEA_TOKEN}@git.narvas.tech/$${CI_REPO}"
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,48 +0,0 @@
when:
branch: master
steps:
update_submodule:
image: woodpeckerci/plugin-git
secrets:
- source: gitea_token
target: GITEA_TOKEN
- source: gitea_user
target: GITEA_USER
commands:
- git submodule update --remote
- if [ ! "$(git status --porcelain)" ]; then echo "no changes"; exit 0; fi
- git config user.name "$${GITEA_USER}"
- git config user.email "$${GITEA_USER}.gitea@narvas.tech"
- git add -A
- git commit -m "update submodules [skip ci]"
- git push "https://$${GITEA_USER}:$${GITEA_TOKEN}@git.narvas.tech/$${CI_REPO}"
when:
cron: nightly
event: [push, tag, deployment, cron, manual]
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,44 +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
COPY submodules/artisan-bash-completion/artisan /etc/bash_completion.d/artisan
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 php-gd \
&& 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 \
&& echo 'alias artisan="php artisan"' >> /etc/bash.bashrc \
&& echo 'source /etc/bash_completion.d/*' >> /etc/bash.bashrc
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"]

View File

@@ -1,15 +1,28 @@
#!/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 [[ "$INSTALL_BEFORE_START" = true ]]; then
echo "composer and npm install"
if [[ "$BOOT_COMPOSER_INSTALL" = true ]]; then
echo "composer install"
composer install
fi
if [[ "$BOOT_NPM_INSTALL" = true ]]; then
echo "npm install"
npm install
fi
@@ -18,10 +31,10 @@ if [ ! -f /var/www/html/artisan ]; then
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
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: