Skip to content

Commit

Permalink
Merge pull request #30 from feat/add-Dockerfile
Browse files Browse the repository at this point in the history
build: Add Dockerfile for pipeline usage
  • Loading branch information
FaisalBudiono authored Oct 23, 2023
2 parents 278608a + 994d244 commit 4505021
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Container Role is used in start.sh
CONTAINER_ROLE=app

APP_NAME=Laravel
APP_ENV=local
APP_KEY=
Expand Down
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM webdevops/php-nginx:8.2
ENV WEB_DOCUMENT_ROOT /app/public
ENV SERVICE_NGINX_CLIENT_MAX_BODY_SIZE 100m
ENV FPM_PM_MAX_CHILDREN 20
WORKDIR /app
RUN apt-get update && apt-get install -y \
libjpeg62-turbo-dev \
libpng-dev \
libzip-dev \
libgmp-dev \
re2c \
libmhash-dev \
libmcrypt-dev \
file \
libxrender1 \
libfontconfig1 \
libfreetype6
COPY --chown=application:application . .
RUN mv start.sh /opt/docker/provision/entrypoint.d/
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY user.ini $PHP_INI_DIR/conf.d/
RUN composer install
EXPOSE 80
39 changes: 39 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

set -e

role=${CONTAINER_ROLE:-app}
env=${APP_ENV:-production}

echo "Running container role \"$role\" in \"$env\" environment. "

php /app/artisan config:cache

if [ "$role" = "app" ]; then

if [ "$env" = "production" ]; then
php /app/artisan migrate --force
else
php /app/artisan migrate
fi

elif [ "$role" = "queue" ]; then

echo "Starting the queues..."
mv queue.conf /opt/docker/etc/supervisor.d/
supervisorctl start queue-default queue-admin
supervisorctl status all

elif [ "$role" = "schedule" ]; then

while [ true ]; do
php /app/artisan schedule:run --verbose --no-interaction &
sleep 60
done

else

echo "Could not match the container role \"$role\""
exit 1

fi
2 changes: 2 additions & 0 deletions user.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
post_max_size = 256M
upload_max_filesize = 128M

0 comments on commit 4505021

Please sign in to comment.