-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
78 lines (61 loc) · 1.95 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
FROM php:8.1-fpm
# Copy composer.lock and composer.json
# COPY ./composer.lock ./composer.json /var/www/
RUN mkdir -p /scripts
COPY ./docker/docker-entry.sh /scripts
ARG APP_ENV=${APP_ENV}
ARG APP_NAME=${APP_NAME}
ENV APP_ENV=${APP_ENV} \
APP_NAME=${APP_NAME}
# Set working directory
WORKDIR /var/www
# Copy existing application directory
COPY ./ /var/www/
RUN ls /var/www
RUN mkdir -p /var/www/var/
# RUN chmod -R 777 /var/www/var
RUN chown -R www-data:www-data /var/www/
# RUN chown -R www:www /var/www/html
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpng-dev \
libpq-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
locales \
zip \
jpegoptim optipng pngquant gifsicle \
vim \
unzip \
git \
curl \
nginx \
zlib1g-dev
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install extensions
# RUN docker-php-ext-install xml curl
# RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
# RUN docker-php-ext-install gd
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=2.2.9
RUN composer install --no-dev --no-interaction -o
# Add user for laravel application
#RUN groupadd -g 1000 www
#RUN useradd -u 1000 -ms /bin/bash -g www www
COPY ./docker/app.conf /etc/nginx/conf.d/app.conf
RUN ls /etc/nginx/conf.d
COPY ./docker/local.ini /usr/local/etc/php/conf.d/local.ini
RUN ls /usr/local/etc/php/conf.d
RUN cat /usr/local/etc/php/conf.d/local.ini
RUN rm -rf /etc/nginx/sites-enabled
RUN mkdir -p /etc/nginx/sites-enabled
RUN chmod -R 777 /var/www/public
#RUN php bin/console cache:clear (don t do it with a symfony app because composer.json script post install and update do it)
# Expose port 80 and start php-fpm server
EXPOSE 80
WORKDIR /scripts
RUN chmod +x ./docker-entry.sh
RUN ls .
CMD ["./docker-entry.sh"]