-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
119 lines (94 loc) · 3.63 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
FROM ubuntu:jammy-20240416 AS base
ENV DEBIAN_FRONTEND noninteractive
# Install dependencies
RUN apt-get update && apt-get install -y wget gnupg2 unzip curl
#
RUN apt install -y ca-certificates gnupg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
ENV NODE_MAJOR 20
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt update
# RUN apt install -y nodejs
RUN apt-get install -y nodejs gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev libxshmfence-dev
RUN npm install -g npm@latest
RUN npm cache clean --force
RUN npm install -g puppeteer --unsafe-perm=true
# Set environment variables for Puppeteer
# ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/google-chrome-stable
# Install dependencies
RUN apt update
RUN apt install -y software-properties-common
RUN add-apt-repository -y ppa:ondrej/php
RUN apt update
RUN apt install -y php8.2\
php8.2-cli\
php8.2-common\
php8.2-fpm\
php8.2-mysql\
php8.2-zip\
php8.2-gd\
php8.2-mbstring\
php8.2-curl\
php8.2-xml\
php8.2-bcmath\
php8.2-pdo\
php8.2-intl\
php8.2-sqlite3
# Install php-fpm
RUN apt install -y php8.2-fpm php8.2-cli
# Install composer
RUN apt install -y curl
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install nodejs
# RUN apt install -y ca-certificates gnupg
# RUN mkdir -p /etc/apt/keyrings
# RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
# ENV NODE_MAJOR 20
# RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
# RUN apt update
# RUN apt install -y nodejs
# Install nginx
RUN apt install -y nginx
RUN echo "\
server {\n\
listen 80;\n\
listen [::]:80;\n\
root /var/www/html/public;\n\
add_header X-Frame-Options \"SAMEORIGIN\";\n\
add_header X-Content-Type-Options \"nosniff\";\n\
index index.php;\n\
charset utf-8;\n\
location / {\n\
try_files \$uri \$uri/ /index.php?\$query_string;\n\
}\n\
location = /favicon.ico { access_log off; log_not_found off; }\n\
location = /robots.txt { access_log off; log_not_found off; }\n\
error_page 404 /index.php;\n\
location ~ \.php$ {\n\
fastcgi_pass unix:/run/php/php8.2-fpm.sock;\n\
fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name;\n\
include fastcgi_params;\n\
}\n\
location ~ /\.(?!well-known).* {\n\
deny all;\n\
}\n\
}\n" > /etc/nginx/sites-available/default
RUN echo "\
#!/bin/sh\n\
echo \"Starting services...\"\n\
service php8.2-fpm start\n\
nginx -g \"daemon off;\" &\n\
echo \"Ready.\"\n\
tail -s 1 /var/log/nginx/*.log -f\n\
" > /start.sh
COPY . /var/www/html
WORKDIR /var/www/html
VOLUME /var/www/html/storage/app/public
RUN chown -R www-data:www-data /var/www/html
RUN composer install
RUN php artisan storage:link
RUN npm install
EXPOSE 80
CMD ["sh", "/start.sh"]