-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
120 lines (100 loc) · 3.37 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
120
FROM phusion/baseimage:focal-1.0.0-alpha1-amd64
ARG DEBIAN_FRONTEND=noninteractive
# Update & install dependencies and do cleanup
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y \
libsecp256k1-0 \
composer \
apache2 \
libapache2-mod-php \
php-mysql \
php-curl \
php-cli \
php-mbstring \
php-json \
php-zmq \
php-bcmath \
php-gmp \
php-bz2 \
php-gd \
php-sqlite3 \
php-zip \
php-intl \
php-xml \
htop \
curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Enable rewrite support for apache2
RUN a2enmod rewrite && \
a2enmod ssl && \
a2enmod proxy && \
a2enmod proxy_http && \
a2enmod proxy_wstunnel && \
a2enmod proxy_ajp && \
a2enmod headers && \
a2dissite 000-default && \
a2disconf other-vhosts-access-log
# Configure virtual host
COPY ./docker/cryptogate-apache2.conf /etc/apache2/sites-available/cryptogate.conf
RUN a2ensite cryptogate
RUN mkdir /app && \
chown -R www-data:www-data /app && \
chown -R www-data:www-data /var/www
# set correct access rights
RUN chown -R www-data:www-data /app/
# Add our startup script
RUN mkdir /etc/service/cryptogate
COPY docker/cryptogate.sh /etc/service/cryptogate/run
RUN chmod +x /etc/service/cryptogate/run
# Add our cryptogate daemon script
RUN mkdir /etc/service/cryptogate-daemon
COPY docker/cryptogate-daemon.sh /etc/service/cryptogate-daemon/run
RUN chmod +x /etc/service/cryptogate-daemon/run
# Add our cryptogate queue script
RUN mkdir /etc/service/cryptogate-queue
COPY docker/cryptogate-queue.sh /etc/service/cryptogate-queue/run
RUN chmod +x /etc/service/cryptogate-queue/run
# cleanup apache2 pid files on boot script
COPY docker/20_startup_apache2.sh /etc/my_init.d/20_startup_apache2.sh
RUN chmod +x /etc/my_init.d/20_startup_apache2.sh
# create container boot time file for checks
COPY docker/19_startup_time.sh /etc/my_init.d/19_startup_time.sh
RUN chmod +x /etc/my_init.d/19_startup_time.sh
# healthcheck
COPY docker/healthcheck.sh /usr/local/bin/healthcheck.sh
RUN chmod +x /usr/local/bin/healthcheck.sh
# Copy our app into docker
COPY ./app /app/app
COPY ./bootstrap /app/bootstrap
COPY ./config /app/config
COPY ./database /app/database
COPY ./public /app/public
COPY ./resources /app/resources
COPY ./routes /app/routes
COPY ./tests /app/tests
COPY ./artisan /app/artisan
COPY ./composer.json /app/composer.json
COPY ./composer.lock /app/composer.lock
RUN mkdir -p /app/storage/app && \
mkdir -p /app/storage/framework && \
mkdir -p /app/storage/logs && \
mkdir -p /app/storage/framework/sessions && \
mkdir -p /app/storage/framework/views && \
mkdir -p /app/storage/framework/cache/data
# set correct access rights for copied files
RUN chown -R www-data:www-data /app/
# install composer dependencies
USER www-data
RUN cd /app && \
COMPOSER_HOME=/var/www composer global require hirak/prestissimo && \
COMPOSER_HOME=/var/www composer install
USER root
# setup symlink for storage volume folder
RUN ln -s /data/storage /app/storage
EXPOSE 80
VOLUME ["/data"]
CMD ["/sbin/my_init"]
#HEALTHCHECK --start-period=10s --interval=10s --timeout=5s --retries=3 CMD /usr/local/bin/healthcheck.sh
HEALTHCHECK --start-period=1s --interval=20s --timeout=2s --retries=3 CMD /bin/true