forked from scandipwa/magento-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
86 lines (70 loc) · 2.75 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
# hadolint ignore=DL3007
FROM scandipwa/php:magento-2.4.1
# Set bash by default
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Default configuration, override in deploy/local.env for localsetup
# Do not remove variables, build depends on them,
# just add "" to empty variable, the latest stable version will used instead
# These arguments are defaults, to override them, use .env
# The list of ENVs must be matched to corresponfing ARGs, to persist values in runtime
ARG PROJECT_TAG=local
ARG BASEPATH=/var/www/public
ARG COMPOSER_HOME=/var/lib/composer
ARG COMPOSER_VERSION=latest
ARG COMPOSER_ALLOW_SUPERUSER=1
ARG NODEJS_DIR=/var/lib/node
ARG NODEJS_VERSION=lts
ARG NPM_CONFIG_LOGLEVEL=warn
ARG DOCKER_DEBUG=false
ARG GOSU_GPG_KEY=B42F6819007F00F88E364FD4036A9C25BF357DD4
# Set working directory so any relative configuration or scripts wont fail
WORKDIR $BASEPATH
# Set permissions for non privileged users to use stdout/stderr
RUN chmod augo+rwx /dev/stdout /dev/stderr /proc/self/fd/1 /proc/self/fd/2
ENV TERM=xterm-256color \
DEBIAN_FRONTEND=noninteractive \
DOCKER_DEBUG=${DOCKER_DEBUG} \
CPU_CORES=$(nproc) \
COMPOSER_ALLOW_SUPERUSER=$(COMPOSER_ALLOW_SUPERUSER) \
COMPOSER_HOME=/var/lib/composer \
MAKE_OPTS="-j $CPU_CORES" \
N_PREFIX=${NODEJS_DIR} \
PATH=${NODEJS_DIR}/bin:${BASEPATH}/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Copy PHP configs
COPY deploy/shared/conf/php/php.ini /usr/local/etc/php/php.ini
COPY deploy/shared/conf/php/docker-php-fpm.conf /usr/local/etc/php-fpm.d/docker.conf
# Copy waiter helper
COPY deploy/wait-for-it.sh /wait-for-it.sh
RUN chmod +x /wait-for-it.sh
# MSMTP config set
RUN { \
echo 'defaults'; \
echo 'logfile /proc/self/fd/2'; \
echo 'timeout 30'; \
echo 'host maildev'; \
echo 'tls off'; \
echo 'tls_certcheck off'; \
echo 'port 25'; \
echo 'auth off'; \
echo 'from no-reply@docker'; \
echo 'account default'; \
} | tee /etc/msmtprc
# Start script, executed upon container creation from image
COPY deploy/start.sh /start.sh
RUN chmod +x /start.sh
# Clean up APT and temp when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY deploy/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Copy project files
COPY src/ $BASEPATH/
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
#ENTRYPOINT ["/entrypoint.sh"]
# Spaces in command arguments will result fail to start, put each argument in "" delimited by ,
#CMD ["arg1", "arg2", ""]
CMD ["/start.sh"]
# Print all versions for verification
RUN echo "$(tput setaf 3)php, composer$(tput sgr0)";\
composer diagnose; printf "\n";\
echo "$(tput setaf 3)nodejs, npm$(tput sgr0)";\
npm doctor; printf "\n";