Skip to content

Commit 10ffa29

Browse files
Improve caching on dockerfiles (#4987)
1 parent 0d6f4ff commit 10ffa29

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

creator-node/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ RUN echo 'http://mirror.leaseweb.com/alpine/v3.13/community' >> /etc/apk/reposit
4747
mkdir /usr/local/openresty/logs && \
4848
mkdir /usr/local/openresty/cache
4949

50-
COPY nginx_conf /usr/local/openresty/conf/
5150

5251
# Create a db user if postgres in case it will be run inside this container
5352
COPY scripts/init-db.sh scripts/init-db.sh
@@ -56,8 +55,7 @@ RUN bash scripts/init-db.sh
5655
COPY --from=builder /app/node_modules node_modules
5756

5857
COPY . .
59-
60-
RUN npm run postinstall
58+
COPY nginx_conf /usr/local/openresty/conf/
6159

6260
# Compile js code to typescript based on tsconfig.build.json
6361
RUN ./node_modules/.bin/tsc --project tsconfig.build.json

discovery-provider/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,20 @@ RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.10/main' >> /etc/apk/repositor
5757
postgresql-libs=11.12-r0 \
5858
postgresql=11.12-r0
5959

60-
COPY nginx_conf /usr/local/openresty/conf/
61-
62-
COPY scripts/init-db.sh scripts/init-db.sh
63-
RUN bash scripts/init-db.sh
6460

6561
# Upgrade pip first to accomodate anchor.py installation
6662
COPY requirements.txt requirements.txt
6763
RUN python3 -m pip install --upgrade pip && python3 -m pip install -r requirements.txt --no-cache-dir
6864

65+
COPY scripts/init-db.sh scripts/init-db.sh
66+
RUN bash scripts/init-db.sh
67+
68+
COPY --from=contracts /usr/src/app/build/contracts/ build/contracts/
69+
6970
COPY . .
7071
RUN --mount=type=cache,target=/root/.npm cd es-indexer && npm ci && npm run build
7172

72-
COPY --from=contracts /usr/src/app/build/contracts/ build/contracts/
73+
COPY nginx_conf /usr/local/openresty/conf/
7374

7475
# ARGs can be optionally defined with --build-arg while doing docker build eg in CI and then set to env vars
7576
ARG git_sha

0 commit comments

Comments
 (0)