Skip to content

Instantly share code, notes, and snippets.

@chooh
Created January 20, 2017 07:29
Show Gist options
  • Save chooh/b8d10c04424ad93f0605cabb6ca7e2e8 to your computer and use it in GitHub Desktop.
Save chooh/b8d10c04424ad93f0605cabb6ca7e2e8 to your computer and use it in GitHub Desktop.
FROM php:7.0-apache
RUN apt-get update && apt-get install -y \
git-core \
ssh-client \
unzip \
--no-install-recommends && rm -r /var/lib/apt/lists/*
# Install composer bin to /usr/local/bin
RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer
# https://github.com/vishnubob/wait-for-it
COPY contrib/wait-for-it.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/wait-for-it.sh
RUN docker-php-ext-install pdo_mysql
# Apache
RUN a2enmod rewrite
COPY contrib/000-default.conf $APACHE_CONFDIR/sites-enabled/000-default.conf
# SSH keys
RUN mkdir /root/.ssh && chmod 700 /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts
ADD contrib/deploy_rsa /root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
# App folders
RUN mkdir /app /app/vendor /app/src
WORKDIR /app/src
# Composer
ENV COMPOSER_VENDOR_DIR /app/vendor
COPY composer.json composer.lock /app/src/
RUN composer install --no-scripts --no-autoloader --no-interaction
COPY . ./
# FIXME, run-script post-install-cmd даёт ошибку `Invalid filename provided` в
# /app/vendor/classpreloader/classpreloader/src/ClassPreloader.php:114
#RUN composer dump-autoload --optimize && \
# composer run-script post-install-cmd
RUN composer dump-autoload --optimize
EXPOSE 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment