-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
56 lines (42 loc) · 1.76 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
FROM crs4/php7-base:7.1
# File Author / Maintainer
MAINTAINER PhenoMeNal-H2020 Project ( [email protected] )
# container version
ENV version="1.3"
# software version
ENV software_version="2.3"
# Image Metadata
LABEL Description="Metadata backend for the PhenoMeNal Portal"
LABEL software="PhenoMeNal Portal"
LABEL version="${version}"
LABEL software.version="${software_version}"
# Optional arguments to choose the Git repo & branch to use at build time
ARG git_repo=phnmnl/portal-metadata-backend
ARG git_branch="v${software_version}"
# Install required packages
RUN apt-get update && apt-get install -y --no-install-recommends mysql-client python2.7 python-pip && \
pip install --upgrade oauth2client && \
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php composer-setup.php && \
php -r "unlink('composer-setup.php');" && \
rm -rf /var/lib/apt/lists/*
# Download the PortalMetadataBackend
RUN echo "Cloning branch '${git_branch}' of the Git repository '${git_repo}'" >&2 && \
git clone --depth 1 --single-branch --branch ${git_branch} https://github.com/${git_repo}.git
# Set working directory
WORKDIR portal-metadata-backend
# Install backend dependencies
RUN php composer.phar install && chmod a+x setup.sh
# Set environment
ENV MYSQL_HOST "localhost"
ENV MYSQL_PORT 3306
ENV SERVICE_PATH "/var/www/html/portal-metadata-backend"
ENV PATH ${SERVICE_PATH}/vendor/propel/propel/bin:${PATH}
# wait-for-it is a utility to wait for MySQL service
ADD wait-for-it.sh /usr/local/bin/wait-for-it
ADD entrypoint.sh ssh_for_git /usr/local/bin/
RUN chmod +rx /usr/local/bin/*
# Default command
CMD ["wait-for-it", "-t", "120", "${MYSQL_HOST}:${MYSQL_PORT}", "--", "entrypoint.sh"]
# Container ports
EXPOSE 8888