Adding Dockerfile, drone build
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Matt Burchett 2021-04-06 23:02:22 -07:00
parent 7b31bf0710
commit 2e10d5d0ab
4 changed files with 52 additions and 27 deletions

10
.drone.yml Normal file
View File

@ -0,0 +1,10 @@
kind: pipeline
name: eliteregistry
type: docker
steps:
- name: Build Docker Image
image: plugins/docker
settings:
repo: registry.linuxrocker.com/eliteregistry
dockerfile: /drone/src/Dockerfile
autotag: true

View File

@ -7,7 +7,7 @@ WORKDIR /var/www
# Install dependencies # Install dependencies
RUN apt-get update \ RUN apt-get update \
# gd # gd
&& apt-get install -y --no-install-recommends build-essential openssl nginx libfreetype6-dev libjpeg-dev libpng-dev libwebp-dev zlib1g-dev libzip-dev gcc g++ make vim unzip curl git jpegoptim optipng pngquant gifsicle locales libonig-dev nodejs npm \ && apt-get install -y --no-install-recommends build-essential procps openssl nginx libfreetype6-dev libjpeg-dev libpng-dev libwebp-dev zlib1g-dev libzip-dev gcc g++ make vim unzip curl git jpegoptim optipng pngquant gifsicle locales libonig-dev \
&& docker-php-ext-configure gd \ && docker-php-ext-configure gd \
&& docker-php-ext-install gd \ && docker-php-ext-install gd \
# gmp # gmp
@ -25,6 +25,18 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/pear/ && rm -rf /tmp/pear/
ENV NVM_DIR /root/.nvm
ENV NODE_VERSION 15.12.0
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
# Copy files # Copy files
COPY . /var/www COPY . /var/www
@ -32,38 +44,26 @@ COPY ./deploy/local.ini /usr/local/etc/php/local.ini
COPY ./deploy/conf.d/nginx.conf /etc/nginx/nginx.conf COPY ./deploy/conf.d/nginx.conf /etc/nginx/nginx.conf
RUN chmod +rwx /var/www RUN chmod +rwx /var/www \
&& chown -R www-data: /var/www/storage
RUN chmod -R 777 /var/www
# setup npm # setup npm
RUN npm install -g npm@latest RUN npm install -g npm@latest \
&& npm install \
RUN npm install && npm run prod
# include your other npm run scripts e.g npm rebuild node-sass
# run your default build command here mine is npm run prod
RUN npm run prod
# setup composer and laravel # setup composer and laravel
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& composer install --working-dir="/var/www" \
RUN composer install --working-dir="/var/www" && composer dump-autoload --working-dir="/var/www" \
&& php artisan route:clear \
RUN composer dump-autoload --working-dir="/var/www" && php artisan route:cache \
&& php artisan config:clear \
RUN php artisan route:clear && php artisan config:cache
RUN php artisan route:cache
RUN php artisan config:clear
RUN php artisan config:cache
EXPOSE 80 EXPOSE 80
RUN ["chmod", "+x", "post_deploy.sh"] RUN ["chmod", "+x", "post_deploy.sh"]
CMD [ "sh", "./post_deploy.sh" ] CMD [ "bash", "./post_deploy.sh" ]
# CMD php artisan serve --host=127.0.0.1 --port=9000 # CMD php artisan serve --host=127.0.0.1 --port=9000

View File

@ -1,8 +1,23 @@
#!/bin/sh #!/usr/bin/env bash
# update application cache # update application cache
php artisan optimize php artisan optimize
if [[ ! -f /data/database.sqlite ]]; then
echo "No database found. Creating."
touch /data/database.sqlite
fi
# perform DB migrations
if [[ ! -f ./database/database.sqlite ]]; then
echo "No link to database. Linking database."
ln -s /data/database.sqlite ./database/database.sqlite
fi
php artisan migrate
# start the application # start the application
php-fpm -D && nginx -g "daemon off;" php-fpm -D && nginx -g "daemon off;"