forked from lephleg/laravel-lumen-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
82 lines (60 loc) · 2.61 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
79
80
81
82
#######################################################################
# Laravel/Lumen 5.8 Application - Dockerfile v0.5 #
#######################################################################
#------------- Setup Environment -------------------------------------------------------------
# Pull base image
FROM ubuntu:18.04
# Install common tools
RUN apt-get update
RUN apt-get install -y wget curl nano htop git unzip bzip2 software-properties-common locales
# Set evn var to enable xterm terminal
ENV TERM=xterm
# Set timezone to UTC to avoid tzdata interactive mode during build
ENV TZ=Etc/UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Set working directory
WORKDIR /var/www/html
# Set up locales
# RUN locale-gen
#------------- Application Specific Stuff ----------------------------------------------------
# Install PHP
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
RUN apt update
RUN apt-get install -y \
php7.4-fpm \
php7.4-common \
php7.4-curl \
php7.4-mysql \
php7.4-mbstring \
php7.4-json \
php7.4-xml \
php7.4-bcmath
# Install NPM and Node.js
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs
#------------- FPM & Nginx configuration ----------------------------------------------------
# Config fpm to use TCP instead of unix socket
ADD resources/www.conf /etc/php/7.4/fpm/pool.d/www.conf
RUN mkdir -p /var/run/php
# Install Nginx
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ABF5BD827BD9BF62
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C
RUN echo "deb http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list
RUN echo "deb-src http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y nginx
ADD resources/default /etc/nginx/sites-enabled/
ADD resources/nginx.conf /etc/nginx/
#------------- Composer & laravel configuration ----------------------------------------------------
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#------------- Supervisor Process Manager ----------------------------------------------------
# Install supervisor
RUN apt-get install -y supervisor
RUN mkdir -p /var/log/supervisor
ADD resources/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
#------------- Container Config ---------------------------------------------------------------
# Expose port 80
EXPOSE 80
# Set supervisor to manage container processes
ENTRYPOINT ["/usr/bin/supervisord"]