Skip to content

Commit 2e665a4

Browse files
author
Anandkumar Patel
committed
modify building for faster deploys
1 parent a162d32 commit 2e665a4

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

ansible/ansible.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[defaults]
2+
# Required so `sudo: yes` does not lose the environment variables, which hold the ssh-agent socket
3+
sudo_flags=-HE

ansible/roles/builder/tasks/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
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+
919
- name: copy dockerfile to build folder
1020
sudo: yes
1121
template:

ansible/roles/builder/templates/basic_node/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,22 @@ ENV {{ env }}
1515
# setup node and npm versions
1616
RUN 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 %}
2420
RUN {{ command }}
2521
{% endfor %}
2622
{% endif %}
2723

24+
# Add Package json first
25+
ADD ./package.json /{{ name }}/package.json
26+
27+
# install, should will skip if no package.json change
28+
WORKDIR /{{ name }}
2829
RUN npm install --production
2930

31+
# Add the rest of the repo
32+
ADD . /{{ name }}
33+
3034
{% if dockerfile_post_install_commands is defined %}
3135
{% for command in dockerfile_post_install_commands %}
3236
RUN {{ command }}

0 commit comments

Comments
 (0)