Initial commit
This commit is contained in:
commit
7d760c25e3
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# NoccyLabs Alpine Nginx+PHP 8.3 Base Image
|
||||||
|
FROM alpine:3.19
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
php83-fpm php83-cli \
|
||||||
|
php83-curl php83-iconv php83-gd php83-mbstring php83-posix \
|
||||||
|
php83-phar php83-openssl php83-ctype php83-tokenizer php83-xml php83-session \
|
||||||
|
php83-dom php83-pecl-imagick php83-zip php83-xmlwriter php83-simplexml php83-xmlreader \
|
||||||
|
php83-pdo php83-pdo_sqlite php83-pdo_mysql php83-fileinfo php83-exif \
|
||||||
|
tini \
|
||||||
|
nginx \
|
||||||
|
supervisor
|
||||||
|
|
||||||
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||||
|
COPY ./config/supervisor/* /etc/supervisor.d/
|
||||||
|
COPY ./config/frameworks/* /scripts/frameworks/
|
||||||
|
COPY ./config/entrypoint.sh /scripts/entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/sbin/tini", "--" ]
|
||||||
|
CMD /scripts/entrypoint.sh
|
||||||
|
WORKDIR /application
|
||||||
|
EXPOSE 80
|
48
Makefile
Normal file
48
Makefile
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
.SILENT:
|
||||||
|
.PHONY: help
|
||||||
|
|
||||||
|
DOCKER_IMAGE = dev.noccylabs.info/noccylabs/alpine-php83-aio:latest
|
||||||
|
|
||||||
|
COLOR_RESET = \033[0m
|
||||||
|
COLOR_INFO = \033[32m
|
||||||
|
COLOR_COMMENT = \033[33m
|
||||||
|
|
||||||
|
### Help
|
||||||
|
help:
|
||||||
|
printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n"
|
||||||
|
printf " make [target]\n\n"
|
||||||
|
printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n"
|
||||||
|
awk '/^[a-zA-Z\-\_0-9\.@]+:/ { \
|
||||||
|
helpMessage = match(lastLine, /^### (.*)/); \
|
||||||
|
if (helpMessage) { \
|
||||||
|
helpCommand = substr($$1, 0, index($$1, ":")); \
|
||||||
|
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
|
||||||
|
printf " ${COLOR_INFO}%-16s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
{ lastLine = $$0 }' $(MAKEFILE_LIST)
|
||||||
|
|
||||||
|
.PHONY: docker
|
||||||
|
### Build docker image
|
||||||
|
docker:
|
||||||
|
docker build -t ${DOCKER_IMAGE} .
|
||||||
|
|
||||||
|
.PHONY: docker-push
|
||||||
|
### Publish image
|
||||||
|
docker-push:
|
||||||
|
docker push ${DOCKER_IMAGE}
|
||||||
|
|
||||||
|
.PHONY: docker-test
|
||||||
|
### Test docker image
|
||||||
|
docker-test:
|
||||||
|
#docker create --name php83-aio ${DOCKER_IMAGE}
|
||||||
|
#docker start -i php83-aio || true
|
||||||
|
#docker stop php83-aio
|
||||||
|
#docker rm php83-aio
|
||||||
|
docker run --rm -it ${DOCKER_IMAGE}
|
||||||
|
|
||||||
|
.PHONY: docker-shell
|
||||||
|
### Open a shell in the container
|
||||||
|
docker-shell:
|
||||||
|
docker run --rm -it ${DOCKER_IMAGE} sh || true
|
||||||
|
|
26
config/entrypoint.sh
Executable file
26
config/entrypoint.sh
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# run scripts in /entrypoint.d/
|
||||||
|
if [ -d /entrypoint.d ]; then
|
||||||
|
echo "[-] Calling entrypoint scripts..."
|
||||||
|
for filename in /entrypoint.d/*.sh; do
|
||||||
|
echo " -> $filename"
|
||||||
|
if ! sh "$filename"; then exit 1; fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "[!] No scripts matching *.sh found in /entrypoint.d"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# run framework setups
|
||||||
|
if [ -d /scripts/frameworks ]; then
|
||||||
|
echo "[-] Calling framework setup scripts..."
|
||||||
|
for filename in /scripts/frameworks/*.sh; do
|
||||||
|
sh "$filename" && break
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "[!] No scripts matching *.sh found in /scripts/frameworks"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pass off to supervisor
|
||||||
|
echo "[-] Spawning supervisor"
|
||||||
|
exec /usr/bin/supervisord -n -c /etc/supervisord.conf
|
9
config/frameworks/00-nginx-site.sh
Normal file
9
config/frameworks/00-nginx-site.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ -f /application/.nginx-site.conf ]; then
|
||||||
|
echo " -- Installing nginx website config..."
|
||||||
|
cp -F /application/.nginx-site.conf /etc/nginx/sites-enabled/default.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# scripts at level 00 should not end the framework setup
|
||||||
|
exit 1
|
9
config/frameworks/10-symfony.sh
Normal file
9
config/frameworks/10-symfony.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ ! -f /application/symfony.lock ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo " == Detected symfony project."
|
||||||
|
cd /application
|
||||||
|
/usr/bin/composer install --no-dev --no-cache --optimize-autoloader --no-progress
|
9
config/frameworks/90-composer.sh
Normal file
9
config/frameworks/90-composer.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ ! -f /application/composer.json ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo " == Detected composer project."
|
||||||
|
cd /application
|
||||||
|
/usr/bin/composer install --no-dev --no-cache --optimize-autoloader --no-progress
|
3
config/frameworks/99-sorry.sh
Normal file
3
config/frameworks/99-sorry.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo " ** Sorry, no framework detected."
|
3
config/supervisor/exit-on-error.ini
Normal file
3
config/supervisor/exit-on-error.ini
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[eventlistener:process-trap]
|
||||||
|
command=sh -c "echo READY && read line && kill -SIGQUIT $PPID"
|
||||||
|
events=PROCESS_STATE_STOPPED,PROCESS_STATE_EXITED,PROCESS_STATE_FATAL
|
9
config/supervisor/nginx.ini
Normal file
9
config/supervisor/nginx.ini
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[program:nginx]
|
||||||
|
command=/usr/sbin/nginx -c /etc/nginx/nginx.conf -g 'daemon off;'
|
||||||
|
autostart=true
|
||||||
|
autorestart=false
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
exitcodes=0
|
9
config/supervisor/php-fpm.ini
Normal file
9
config/supervisor/php-fpm.ini
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[program:php-fpm]
|
||||||
|
command=/usr/sbin/php-fpm83 -F
|
||||||
|
autostart=true
|
||||||
|
autorestart=false
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
exitcodes=0
|
Loading…
Reference in New Issue
Block a user