-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
72 lines (50 loc) · 1.58 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
# Usage
# docker build --no-cache -t php-node:latest .
# docker run -d -p 3000:3000 php-node:latest
FROM php:7.3-cli
ENV NODE_VERSION 16.11.1
ENV ARCH x64
ENV NODE_PACKAGE node-v$NODE_VERSION-linux-$ARCH.tar.xz
ENV NODE_URL "https://nodejs.org/dist/v$NODE_VERSION/$NODE_PACKAGE"
ARG ENV=unknown
ARG GIT_COMMIT=unknown
LABEL GIT_COMMIT=${GIT_COMMIT}
LABEL maintainer="Ville de Montréal"
EXPOSE 3200
# Install linux extras
RUN apt-get update \
&& apt-get install -y zip \
git \
wget \
curl \
xz-utils
# Create app directory
# Set timezone
# Install composer
RUN mkdir -p /usr/src/app \
&& ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && dpkg-reconfigure --frontend noninteractive tzdata \
&& curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer
# Create a node user
RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
# Install Node & gulp
RUN curl -SLO "$NODE_URL" \
&& tar -xJf "$NODE_PACKAGE" -C /usr/local --strip-components=1 --no-same-owner \
&& rm "$NODE_PACKAGE" \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& node -v \
&& npm install gulpjs/gulp-cli -g \
&& gulp -v
# Set working volumes and permissions
RUN chmod o+w /usr/src/app
USER node
COPY . /usr/src/app
WORKDIR /usr/src/app
VOLUME /usr/src/app/source
# Check work directory, install npm and composer dependencies
RUN ls -al \
&& npm install \
&& composer install
# Serve the project, npm start would work just as well
CMD ["gulp", "serve"]