File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ [defaults]
2+ # Required so `sudo: yes` does not lose the environment variables, which hold the ssh-agent socket
3+ sudo_flags =-HE
Original file line number Diff line number Diff line change 66 path="{{ build_dir }}/{{ name }}"
77 state=directory
88
9+ - name : pull the git repository
10+ sudo : yes
11+ git :
12+ repo="{{ repo }}"
13+ dest="{{ build_dir }}/{{ name }}"
14+ version="{{ git_branch }}"
15+ update=yes
16+ accept_hostkey=True
17+ force=yes
18+ depth=1
19+
920- name : copy dockerfile to build folder
1021 sudo : yes
1122 template :
Original file line number Diff line number Diff line change @@ -15,18 +15,22 @@ ENV {{ env }}
1515# setup node and npm versions
1616RUN n {{ node_version }} && npm install -g npm@{{ npm_version }}
1717
18- # Download Repo
19- RUN git clone -b {{ git_branch }} --single-branch {{ repo }} /{{ name }}
20-
21- WORKDIR /{{ name }}
2218{% if dockerfile_pre_install_commands is defined %}
2319{% for command in dockerfile_pre_install_commands %}
2420RUN {{ command }}
2521{% endfor %}
2622{% endif %}
2723
24+ # Add package.json from the current build context (`.` is the repo) first
25+ ADD ./package.json /{{ name }}/package.json
26+
27+ # install, should will skip if no package.json change
28+ WORKDIR /{{ name }}
2829RUN npm install --production
2930
31+ # move the current build context (`.` is the repo) to /{{ name }}
32+ ADD . /{{ name }}
33+
3034{% if dockerfile_post_install_commands is defined %}
3135{% for command in dockerfile_post_install_commands %}
3236RUN {{ command }}
@@ -35,4 +39,3 @@ RUN {{ command }}
3539
3640# Define default command.
3741CMD ulimit -c unlimited && /usr/local/bin/npm {{ npm_start_command | default('start' ) }} > /var/log/{{ name }}.log 2>&1
38-
You can’t perform that action at this time.
0 commit comments