Adding Dockerfile, drone build
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7b31bf0710
commit
2e10d5d0ab
10
.drone.yml
Normal file
10
.drone.yml
Normal 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
|
52
Dockerfile
52
Dockerfile
@ -7,7 +7,7 @@ WORKDIR /var/www
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
# 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-install gd \
|
||||
# gmp
|
||||
@ -25,6 +25,18 @@ RUN apt-get update \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& 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 . /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
|
||||
|
||||
RUN chmod +rwx /var/www
|
||||
|
||||
RUN chmod -R 777 /var/www
|
||||
RUN chmod +rwx /var/www \
|
||||
&& chown -R www-data: /var/www/storage
|
||||
|
||||
# setup npm
|
||||
RUN npm install -g npm@latest
|
||||
|
||||
RUN npm install
|
||||
|
||||
# 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
|
||||
RUN npm install -g npm@latest \
|
||||
&& npm install \
|
||||
&& npm run prod
|
||||
|
||||
# setup composer and laravel
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
|
||||
RUN composer install --working-dir="/var/www"
|
||||
|
||||
RUN composer dump-autoload --working-dir="/var/www"
|
||||
|
||||
RUN php artisan route:clear
|
||||
|
||||
RUN php artisan route:cache
|
||||
|
||||
RUN php artisan config:clear
|
||||
|
||||
RUN php artisan config:cache
|
||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
|
||||
&& composer install --working-dir="/var/www" \
|
||||
&& composer dump-autoload --working-dir="/var/www" \
|
||||
&& php artisan route:clear \
|
||||
&& php artisan route:cache \
|
||||
&& php artisan config:clear \
|
||||
&& php artisan config:cache
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
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
|
||||
|
@ -1,8 +1,23 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# update application cache
|
||||
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
|
||||
|
||||
php-fpm -D && nginx -g "daemon off;"
|
||||
|
Loading…
Reference in New Issue
Block a user