1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00

Added version var as a build argument

This commit is contained in:
eldadfux 2019-11-29 09:34:13 +02:00
parent 7d04afd962
commit 05b51bd700
2 changed files with 21 additions and 18 deletions

View file

@ -15,20 +15,24 @@ RUN \
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && \ LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && \
apt-get update && \ apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests make php$PHP_VERSION php$PHP_VERSION-dev zip unzip php$PHP_VERSION-zip && \ apt-get install -y --no-install-recommends --no-install-suggests make php$PHP_VERSION php$PHP_VERSION-dev zip unzip php$PHP_VERSION-zip && \
# redis php extension # Redis Extension
wget -q https://github.com/phpredis/phpredis/archive/$PHP_REDIS_VERSION.tar.gz && \ wget -q https://github.com/phpredis/phpredis/archive/$PHP_REDIS_VERSION.tar.gz && \
tar -xf $PHP_REDIS_VERSION.tar.gz && \ tar -xf $PHP_REDIS_VERSION.tar.gz && \
cd phpredis-$PHP_REDIS_VERSION && \ cd phpredis-$PHP_REDIS_VERSION && \
phpize$PHP_VERSION && \ phpize$PHP_VERSION && \
./configure && \ ./configure && \
make && \ make && \
# composer # Composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
WORKDIR /usr/local/src/ WORKDIR /usr/local/src/
# Updating PHP dependencies and auto-loading...
# Updating PHP Dependencies and Auto-loading...
ENV TESTING=$TESTING ENV TESTING=$TESTING
COPY composer.* /usr/local/src/ COPY composer.* /usr/local/src/
RUN composer update --ignore-platform-reqs --optimize-autoloader \ RUN composer update --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist \ --no-plugins --no-scripts --prefer-dist \
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi` `if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
@ -36,6 +40,8 @@ RUN composer update --ignore-platform-reqs --optimize-autoloader \
FROM ubuntu:18.04 FROM ubuntu:18.04
LABEL maintainer="team@appwrite.io" LABEL maintainer="team@appwrite.io"
ARG VERSION=dev
ENV TZ=Asia/Tel_Aviv \ ENV TZ=Asia/Tel_Aviv \
DEBIAN_FRONTEND=noninteractive \ DEBIAN_FRONTEND=noninteractive \
PHP_VERSION=7.3 \ PHP_VERSION=7.3 \
@ -56,7 +62,8 @@ ENV TZ=Asia/Tel_Aviv \
_APP_STATSD_HOST=telegraf \ _APP_STATSD_HOST=telegraf \
_APP_STATSD_PORT=8125 \ _APP_STATSD_PORT=8125 \
_APP_SMTP_HOST=smtp \ _APP_SMTP_HOST=smtp \
_APP_SMTP_PORT=25 _APP_SMTP_PORT=25 \
_APP_VERSION=$VERSION
#ENV _APP_SMTP_SECURE '' #ENV _APP_SMTP_SECURE ''
#ENV _APP_SMTP_USERNAME '' #ENV _APP_SMTP_USERNAME ''
#ENV _APP_SMTP_PASSWORD '' #ENV _APP_SMTP_PASSWORD ''
@ -72,48 +79,48 @@ RUN \
apt-get update && \ apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests htop supervisor php$PHP_VERSION php$PHP_VERSION-fpm \ apt-get install -y --no-install-recommends --no-install-suggests htop supervisor php$PHP_VERSION php$PHP_VERSION-fpm \
php$PHP_VERSION-mysqlnd php$PHP_VERSION-curl php$PHP_VERSION-imagick php$PHP_VERSION-mbstring php$PHP_VERSION-dom webp && \ php$PHP_VERSION-mysqlnd php$PHP_VERSION-curl php$PHP_VERSION-imagick php$PHP_VERSION-mbstring php$PHP_VERSION-dom webp && \
# nginx # Nginx
echo "deb http://nginx.org/packages/mainline/ubuntu/ bionic nginx" >> /etc/apt/sources.list.d/nginx.list && \ echo "deb http://nginx.org/packages/mainline/ubuntu/ bionic nginx" >> /etc/apt/sources.list.d/nginx.list && \
wget -q http://nginx.org/keys/nginx_signing.key && \ wget -q http://nginx.org/keys/nginx_signing.key && \
apt-key add nginx_signing.key && \ apt-key add nginx_signing.key && \
apt-get update && \ apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests nginx && \ apt-get install -y --no-install-recommends --no-install-suggests nginx && \
# redis php extension # Redis Extension
echo extension=redis.so >> /etc/php/$PHP_VERSION/fpm/conf.d/redis.ini && \ echo extension=redis.so >> /etc/php/$PHP_VERSION/fpm/conf.d/redis.ini && \
echo extension=redis.so >> /etc/php/$PHP_VERSION/cli/conf.d/redis.ini && \ echo extension=redis.so >> /etc/php/$PHP_VERSION/cli/conf.d/redis.ini && \
# composer # Cleanup
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer && \
# cleanup
cd ../ && \ cd ../ && \
apt-get purge -y --auto-remove software-properties-common gnupg curl && \ apt-get purge -y --auto-remove software-properties-common gnupg curl && \
apt-get clean && \ apt-get clean && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Set upload limit # Set Upload Limit
RUN echo "upload_max_filesize = 4M" > /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini RUN echo "upload_max_filesize = 4M" > /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
# nginx conf (with ssl certificates) # Nginx Configuration (with self-signed ssl certificates)
COPY ./docker/nginx.conf /etc/nginx/nginx.conf COPY ./docker/nginx.conf /etc/nginx/nginx.conf
COPY ./docker/ssl/cert.pem /etc/nginx/ssl/cert.pem COPY ./docker/ssl/cert.pem /etc/nginx/ssl/cert.pem
COPY ./docker/ssl/key.pem /etc/nginx/ssl/key.pem COPY ./docker/ssl/key.pem /etc/nginx/ssl/key.pem
# php conf # PHP Configuration
RUN mkdir -p /var/run/php RUN mkdir -p /var/run/php
COPY ./docker/www.conf /etc/php/7.3/fpm/pool.d/www.conf COPY ./docker/www.conf /etc/php/7.3/fpm/pool.d/www.conf
# add PHP files # Add PHP Source Code
COPY ./app /usr/share/nginx/html/app COPY ./app /usr/share/nginx/html/app
COPY ./docs /usr/share/nginx/html/docs COPY ./docs /usr/share/nginx/html/docs
COPY ./public /usr/share/nginx/html/public COPY ./public /usr/share/nginx/html/public
COPY ./src /usr/share/nginx/html/src COPY ./src /usr/share/nginx/html/src
COPY --from=builder /usr/local/src/vendor /usr/share/nginx/html/vendor COPY --from=builder /usr/local/src/vendor /usr/share/nginx/html/vendor
# Set Version
RUN mkdir -p /storage/uploads && \ RUN mkdir -p /storage/uploads && \
mkdir -p /storage/cache && \ mkdir -p /storage/cache && \
chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \ chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \
chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache
# supervisord conf # Supervisord Conf
COPY ./docker/supervisord.conf /etc/supervisord.conf COPY ./docker/supervisord.conf /etc/supervisord.conf
COPY ./docker/entrypoint.sh /entrypoint.sh COPY ./docker/entrypoint.sh /entrypoint.sh
RUN chmod 775 /entrypoint.sh RUN chmod 775 /entrypoint.sh

View file

@ -13,10 +13,6 @@ then
printf "${RED}GEO country DB has not been updated for more than 6 months. Go to https://dev.maxmind.com/geoip/geoip2/geolite2/ for more info${NC}\n" printf "${RED}GEO country DB has not been updated for more than 6 months. Go to https://dev.maxmind.com/geoip/geoip2/geolite2/ for more info${NC}\n"
fi fi
echo "Setting Version #"
echo -e "<?php\n\nconst VERSION = '$1';\n\nreturn VERSION;" > app/config/version.php
echo 'Starting build...' echo 'Starting build...'
docker build -t appwrite/appwrite:"$1" . docker build -t appwrite/appwrite:"$1" .