-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile-local-dev
80 lines (60 loc) · 2.26 KB
/
Dockerfile-local-dev
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
# -- Usage tips and directives
# Always launch on a a freshly clone repo, not installed
# -- Build the image without cache (required)
# docker build --no-cache -t php-node:latest .
# -- Enter the image using commande line to explore & debug
# docker run -it php-node:latest bash
# -- Serve the content on localhost:3000 from a detached volume, no edits possible (docker run command of some kind required)
# docker run -d -p 3000:3000 php-node:latest
# -- Serve the content on localhost:3000 binding your local voluem for edits and dev work
# docker run -d -p 3000:3000 -v $(pwd)/source:/usr/src/app/source php-node:latest
# -- Liste active containers, use 'docker kill CONTAINER_ID' to stop
# docker container ls
# - - - - - - - - - - - - - - - - - -
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"
RUN apt-get update \
&& apt-get install -y zip \
git \
wget \
curl \
xz-utils
#ARG ENV=unknown
ARG GIT_COMMIT=unknown
# GIT label of the packaged code
LABEL GIT_COMMIT=${GIT_COMMIT}
LABEL maintainer="Ville de Montréal"
#Create app directory
RUN mkdir -p /usr/src/app
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && dpkg-reconfigure --frontend noninteractive tzdata
# Install required php extensions
RUN docker-php-ext-install sockets
# Install composer globally
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
# Create a node user ADD RUN groupadd --gid 1000 node \
RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node
RUN dpkg --print-architecture
RUN curl -SLO $NODE_URL
# RUN grep node-v$NODE_VERSION-linux-$ARCH.tar.xz
RUN echo " Node package installed :" $NODE_PACKAGE
RUN echo " Node URL : " $NODE_URL
RUN tar -xJf "$NODE_PACKAGE" -C /usr/local --strip-components=1 --no-same-owner
RUN rm $NODE_PACKAGE
RUN ln -s /usr/local/bin/node /usr/local/bin/nodejs
RUN node -v
RUN npm install gulp -g
RUN npm install gulpjs/gulp-cli -g
RUN gulp -v
RUN chmod o+w /usr/src/app
COPY . /usr/src/app
WORKDIR /usr/src/app
RUN npm install
RUN composer install
EXPOSE 3000
CMD ["gulp", "serve"]
# CMD ["npm", "start"]