eliteregistry/Dockerfile

70 lines
1.9 KiB
Docker
Raw Permalink Normal View History

2021-04-07 05:06:48 +00:00
FROM php:7.4-fpm
USER root
WORKDIR /var/www
# Install dependencies
RUN apt-get update \
# gd
2021-04-07 06:02:22 +00:00
&& 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 \
2021-04-07 05:06:48 +00:00
&& docker-php-ext-configure gd \
&& docker-php-ext-install gd \
# gmp
&& apt-get install -y --no-install-recommends libgmp-dev \
&& docker-php-ext-install gmp \
# pdo_mysql
&& docker-php-ext-install pdo_mysql mbstring \
# pdo
&& docker-php-ext-install pdo \
# opcache
&& docker-php-ext-enable opcache \
# zip
&& docker-php-ext-install zip \
&& apt-get autoclean -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/pear/
2021-04-07 06:02:22 +00:00
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
2021-04-07 05:06:48 +00:00
# Copy files
COPY . /var/www
COPY ./deploy/local.ini /usr/local/etc/php/local.ini
COPY ./deploy/conf.d/nginx.conf /etc/nginx/nginx.conf
2021-04-07 06:02:22 +00:00
RUN chmod +rwx /var/www \
&& chown -R www-data: /var/www/storage
2021-04-07 05:06:48 +00:00
# setup npm
2021-04-07 06:02:22 +00:00
RUN npm install -g npm@latest \
&& npm install \
&& npm run prod
2021-04-07 05:06:48 +00:00
# setup composer and laravel
2021-04-07 06:02:22 +00:00
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
2021-04-07 05:06:48 +00:00
EXPOSE 80
RUN ["chmod", "+x", "post_deploy.sh"]
2021-04-07 06:02:22 +00:00
CMD [ "bash", "./post_deploy.sh" ]
2021-04-07 05:06:48 +00:00
# CMD php artisan serve --host=127.0.0.1 --port=9000