-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.template
169 lines (159 loc) · 5 KB
/
Dockerfile.template
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
{{
def is_alpine:
env.variant | index("alpine")
-}}
{{
def is_apache:
env.variant | index("apache")
-}}
FROM php:{{ env.phpVersion }}-{{ env.variant }}
ENV VERSION="{{ env.ocBrVersion }}" \
OCBR_HTTP_SERVER="" \
\
# Variáveis de ambiente do Banco de Dados
OCBR_DB_DRIVER="pdo" \
OCBR_DB_HOST="0.0.0.0" \
OCBR_DB_USER="root" \
OCBR_DB_PASS="" \
OCBR_DB_DATABASE="opencartbrasil" \
OCBR_DB_PORT="3306" \
OCBR_DB_PREFIX="ocbr_" \
\
# Variáveis de ambiente do usuário da administração
OCBR_ADMIN_USER="" \
OCBR_ADMIN_PASS="" \
OCBR_ADMIN_EMAIL="webmaster@localhost" \
\
# Variáveis de ambiente para serviço de e-mail
MAIL_DRIVER="" \
MAIL_PARAMETER="" \
MAIL_SERVER="" \
MAIL_USER="" \
MAIL_PASS="" \
MAIL_PORT="" \
MAIL_TIMEOUT="" \
MAIL_ADDITIONAL_MAILS=""
# Instala as dependências necessárias e habilita as extensões do PHP
RUN set -ex; \
{{ if is_alpine then ( -}}
apk update; \
apk add --no-cache \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libxml2-dev \
oniguruma-dev \
libzip-dev \
bash \
netcat-openbsd \
openssl-dev; \
{{ ) else ( -}}
apt update; \
apt install -y --no-install-recommends \
apt-transport-https \
libjpeg62-turbo-dev \
libfreetype6-dev \
libpng-dev \
libxml2-dev \
libonig-dev \
libzip-dev \
netcat \
libcurl4-openssl-dev; \
{{ ) end -}}
\
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg; \
\
docker-php-ext-install -j$(nproc) \
gd \
pdo \
mbstring \
pdo_mysql \
zip; \
\
curl -sSLo- https://getcomposer.org/installer | php -- --filename=composer --install-dir=/bin; \
docker-php-source delete \
{{ if is_alpine then ( -}}
;
{{ ) else ( -}}
; apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*;
{{ ) end -}}
# Configura regras de exibição do log
RUN { \
echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \
echo 'display_errors = Off'; \
echo 'display_startup_errors = Off'; \
echo 'error_log = /dev/stderr'; \
echo 'log_errors = On'; \
echo 'log_errors_max_len = 1024'; \
echo 'ignore_repeated_errors = On'; \
echo 'ignore_repeated_source = Off'; \
echo 'html_errors = Off'; \
echo 'zend.exception_ignore_args = Off'; \
echo 'zend.exception_string_param_max_len = 25'; \
} > /usr/local/etc/php/conf.d/error-logging.ini
# Configura o PHP para funcionamento da plataforma
RUN { \
echo 'allow_url_fopen = On'; \
echo 'default_charset = UTF-8'; \
echo 'file_uploads = On'; \
echo 'max_execution_time = 360'; \
echo 'memory_limit = 128M'; \
echo 'upload_max_filesize = 200M'; \
echo 'open_basedir = none'; \
echo "user_agent = \"Curl-OpenCartBrasil/{{ env.ocBrVersion }}\""; \
echo 'post_max_size = 200M'; \
echo 'session.auto_start = Off'; \
echo 'session.use_only_cookies = On'; \
echo 'session.use_cookies = On'; \
echo 'session.use_trans_sid = Off'; \
echo 'session.cookie_httponly = Off'; \
echo 'session.cache_limiter = nocache'; \
} > /usr/local/etc/php/conf.d/opencart-brasil.ini;
# Realiza download da versão
RUN set -aux; \
curl -sSLo opencart.tar.gz "https://github.com/opencartbrasil/opencartbrasil/archive/refs/tags/v{{ env.ocBrVersion }}.tar.gz"; \
mkdir -p /usr/src/opencart; \
tar -xzvf opencart.tar.gz -C /usr/src/opencart --strip-components 1; \
rm opencart.tar.gz; \
\
for oc_folder in \
"/var/www/html/admin/" \
"/var/www/html/install/" \
"/var/www/html/image/cache/" \
"/var/www/html/image/catalog/" \
"/var/www/html/system/storage/cache/" \
"/var/www/html/system/storage/logs/" \
"/var/www/html/system/storage/download/" \
"/var/www/html/system/storage/upload/" \
"/var/www/html/system/storage/session/" \
"/var/www/html/system/storage/modification/"; \
do \
if [ ! -d $oc_folder ]; then \
mkdir -p $oc_folder; \
fi; \
chown -R www-data:www-data $oc_folder; \
done; \
\
for oc_file in \
"/var/www/html/admin/config.php" \
"/var/www/html/config.php"; \
do \
if [ ! -f $oc_file ]; then \
touch $oc_file; \
fi; \
chown www-data:www-data $oc_file; \
done;
{{ if is_apache then ( -}}
RUN set -aux; \
a2enmod rewrite; \
a2enmod expires
{{ ) else "" end -}}
VOLUME /var/www/html
COPY scripts/ /scripts
# Built-in
EXPOSE 8888
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD {{ [ if env.variant == "apache" then "apache2-foreground" else "php-fpm" end ] | @json }}