-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile_satellite
127 lines (103 loc) · 4.29 KB
/
Dockerfile_satellite
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
# syntax=docker/dockerfile:1
# Using multi-stage builds! https://docs.docker.com/develop/develop-images/multistage-build/
FROM php:8.0-fpm-alpine AS php_fpm_with_addons_install
#of course we can use this installer https://github.com/mlocati/docker-php-extension-installer
#but let's keep our docker images minimal
#and not use any packages provided by alpine linux to increase portability
#copy default config
#RUN docker-php-source extract
#RUN cp /usr/src/php/php.ini-production "${PHP_INI_DIR}/php.ini"
# You have to install all of these packages. look if your linux distro has these in their repos
#RUN apk -U upgrade
#autoconf gcc
RUN echo "https://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk -U add --no-cache oniguruma oniguruma-dev unixodbc unixodbc-dev autoconf gcc libc-dev yaml yaml-dev make mariadb-connector-odbc
# install sockets extension
RUN docker-php-ext-install sockets
RUN docker-php-ext-enable sockets
# install mbstring extension
# Note: Script docker-php-ext-configure executed automatically in docker-php-ext-install!
# So no need to run it directly unless you want to pass through specific flags for ./configure
#RUN docker-php-ext-configure --enable-mbstring
RUN docker-php-ext-install mbstring
RUN docker-php-ext-enable mbstring
# install EXT_PDO and EXT_ODBC (unixODBC) (we don't use something like pdo_mysql extension, we use ODBC!)
# ODBC is used by many databases such as MariaDB and MySQL
RUN docker-php-ext-install pdo
# "WINDOWS.H does not exist error" drives me crazy
#HACK
RUN set -ex; \
docker-php-source extract; \
{ \
echo '# https://github.com/docker-library/php/issues/103#issuecomment-271413933'; \
echo 'AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl'; \
echo; \
cat /usr/src/php/ext/odbc/config.m4; \
} > temp.m4; \
mv temp.m4 /usr/src/php/ext/odbc/config.m4; \
docker-php-ext-configure odbc --with-unixODBC=shared,/usr; \
docker-php-ext-install odbc; \
docker-php-source delete
#HACK
#RUN apk -U add --no-cache php81-odbc
#RUN docker-php-ext-configure odbc --with-unixODBC=shared,/usr/
#RUN docker-php-ext-install odbc
RUN docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr/
RUN docker-php-ext-install pdo_odbc
RUN docker-php-ext-enable pdo odbc pdo_odbc
# install PECL extensions
# install EXT_YAML
#RUN apk add autoconf gcc libc-dev yaml yaml-dev make
RUN pecl install yaml
RUN docker-php-ext-enable yaml
# check that everything was indeed installed
RUN php -i|grep pdo \
&& php -i | grep mbstring \
&& php -i | grep odbc \
&& php -i | grep yaml
#delete sources and cache as we don't need them anymore
RUN rm -f /var/cache/apk/*
#FROM php_with_addons AS composer_install
# install composer to our image from Docker image
COPY --from=composer /usr/bin/composer /usr/bin/composer
# install composer directly (if you want)
#RUN curl -sS https://getcomposer.org/installer | php && \
# chmod +x composer.phar && \
# mv composer.phar /usr/bin/composer
#FROM composer_install AS liquidms_install
#install liquidMS as an app
#it must be already cloned from "https://github.com/zibonbadi/liquidms.git"
COPY dist/ /var/www/liquidms
COPY satellite.config.yaml /var/www/liquidms/config.yaml
#RUN chown -R www-data:www-data /var/www
WORKDIR /var/www/liquidms
# should be redundant given the dir copy
RUN composer install
#RUN composer update
#RUN composer dump-autoload
EXPOSE 5029
RUN apk -U add --no-cache mariadb-connector-odbc
#ADD odbcinst.ini /etc/odbcinst.ini
RUN mkdir /docker-entrypoint-initdb.d && \
mkdir /scripts
#ADD run-satellite.sh /scripts/run.sh
ADD install_odbc.sh /scripts/install_odbc.sh
ADD install_config.sh /scripts/install_config.sh
RUN chmod +x /scripts/install_odbc.sh /scripts/install_config.sh
#ADD odbc.ini /etc/odbc.ini
RUN adduser -H -D liquidms_user
RUN apk -U add --no-cache mysql-client
ARG ODBC_HOST=$ODBC_HOST \
ODBC_PORT=$ODBC_PORT \
MYSQL_DATABASE=$MYSQL_DATABASE \
MYSQL_USER=$MYSQL_USER \
MYSQL_PASSWORD=$MYSQL_PASSWORD \
MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
RUN /scripts/install_odbc.sh
RUN /scripts/install_config.sh
#develpoment web-server
#ENTRYPOINT ["/scripts/run.sh"]
#ENTRYPOINT ["su", "liquidms_user", "-c", "php", "-S", "0.0.0.0:8080", "/var/www/liquidms/public/index.php"]
#ENTRYPOINT ["su", "liquidms_user", "-c", "php -S 0.0.0.0:8080 /var/www/liquidms/public/index.php"]
#production php-fashcgi
#ENTRYPOINT ["php-fpm" ]