Skip to content

Commit

Permalink
Segment into a multi-stage build process
Browse files Browse the repository at this point in the history
Carlgo11 committed Aug 16, 2020
1 parent e809fb9 commit d65f240
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
FROM alpine
FROM alpine AS jekyll

###
# Environment variables
###

ENV UNIFI_SITE=default
ENV UNIFI_VERSION=5.13.32

###
# Jekyll
@@ -7,8 +14,10 @@ FROM alpine
# Install Jekyll dependencies
RUN apk add --no-cache build-base libxml2-dev libxslt-dev ruby-full ruby-dev gcc linux-headers

# Copy Jekyll files
# Create www user
RUN adduser -D -u 1000 -h /tmp/www www

# Copy Jekyll files
COPY --chown=www:www jekyll /tmp/jekyll
WORKDIR /tmp/jekyll

@@ -28,13 +37,18 @@ RUN mv _site /opt/www/
# Remove Jekyll dependencies
RUN apk del build-base libxml2-dev libxslt-dev ruby-full ruby-dev gcc linux-headers

FROM alpine

###
# PHP
###

# Install PHP dependencies
RUN apk add --no-cache php-fpm php-curl php-json php-session composer

# Create www user
RUN adduser -D -u 1000 -h /tmp/www www

# Set up PHP-FPM
COPY php-install.sh /
RUN chmod +x /php-install.sh; /bin/sh /php-install.sh; rm /php-install.sh
@@ -63,5 +77,7 @@ RUN mkdir /run/nginx
RUN sed -i 's/cgi.fix_pathinfo= 0/cgi.fix_pathinfo=1/g' /etc/php7/php.ini
ONBUILD RUN chown www:www /opt/www/ -R

COPY --chown=1000 --from=jekyll /opt/www/ /opt/www/

EXPOSE 80
CMD php-fpm7 && nginx; tail -F /var/log/nginx/error.log

0 comments on commit d65f240

Please sign in to comment.