Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit 780b077

Browse files
Dockerfile rework
* Negative approach to .dockerignore * Reintruduction of turbo * Removed unnecessary apt-get calls * Moved docs compilation into a separate layer, which gets cached * Changed turbo paths to actual output directories
1 parent 4d66c2c commit 780b077

File tree

9 files changed

+60
-85
lines changed

9 files changed

+60
-85
lines changed

.circleci/config.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,18 +171,21 @@ jobs:
171171
resource_class: xlarge
172172
steps:
173173
- checkout
174-
- setup_remote_docker
174+
- setup_remote_docker:
175+
docker_layer_caching: true
175176
- run:
176177
command: |
177178
/scripts/build-image.sh web3f/otv-backend . --build-arg PACKAGE=core
178179
180+
179181
buildGatewayImage:
180182
docker:
181183
- image: web3f/ci-commons:v3.2.3
182184
resource_class: xlarge
183185
steps:
184186
- checkout
185-
- setup_remote_docker
187+
- setup_remote_docker:
188+
docker_layer_caching: true
186189
- run:
187190
command: |
188191
/scripts/build-image.sh web3f/otv-gateway . --build-arg PACKAGE=gateway
@@ -193,7 +196,8 @@ jobs:
193196
resource_class: xlarge
194197
steps:
195198
- checkout
196-
- setup_remote_docker
199+
- setup_remote_docker:
200+
docker_layer_caching: true
197201
- run:
198202
command: |
199203
/scripts/build-image.sh web3f/otv-telemetry . --build-arg PACKAGE=telemetry
@@ -204,7 +208,8 @@ jobs:
204208
resource_class: xlarge
205209
steps:
206210
- checkout
207-
- setup_remote_docker
211+
- setup_remote_docker:
212+
docker_layer_caching: true
208213
- run:
209214
command: |
210215
/scripts/build-image.sh web3f/otv-worker . --build-arg PACKAGE=worker

.dockerignore

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
alice
2-
bob
3-
.dockerignore
4-
node_modules
5-
scripts
6-
test
7-
zero
8-
*.db
9-
charts
10-
helmfile.d
11-
build
12-
.circleci
13-
.editorconfig
14-
.git
15-
.github
16-
.gitignore
17-
.idea
18-
combined.log
19-
docker-compose.yml
20-
node_modules/
21-
22-
*/**/node_modules/
1+
*
2+
!docs
3+
!packages
4+
!package.json
5+
!tsconfig.json
6+
!turbo.json
7+
!.yarnrc.yml
8+
!yarn.lock
9+
!.yarn/patches
10+
!.yarn/releases
11+
!.yarn/plugins
12+
!.yarn/sdks
13+
!.yarn/versions

Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ ARG MATRIX_TOKEN
33
ARG PACKAGE
44
ENV PACKAGE ${PACKAGE}
55
WORKDIR /code
6+
7+
COPY docs docs
8+
RUN cd docs && npm install && npm run build
9+
610
COPY . .
7-
RUN echo "building ${PACKAGE}... "; \
8-
yarn install; \
9-
echo "yarn install done. Building...." ; \
10-
yarn build; \
11-
echo "building ${PACKAGE} done."; \
12-
apt-get update && \
13-
apt-get clean
14-
CMD yarn run start:js:${PACKAGE}
11+
12+
RUN --mount=type=cache,target=/code/.yarn/cache \
13+
--mount=type=cache,target=/turbo_cache \
14+
yarn install --immutable && \
15+
yarn turbo --cache-dir /turbo_cache
16+
17+
CMD yarn run start:js:${PACKAGE}

Dockerfile-dev

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ ARG PACKAGE
55
ENV PACKAGE ${PACKAGE}
66
COPY . /code
77
WORKDIR /code
8-
RUN echo "building ${PACKAGE}... "; \
9-
yarn install; \
10-
echo "yarn install done. Building...." ; \
11-
yarn build; \
12-
echo "building ${PACKAGE} done."; \
8+
RUN echo "building ${PACKAGE}... " && \
9+
yarn install && \
10+
echo "yarn install done. Building...." && \
11+
yarn build && \
12+
echo "building ${PACKAGE} done." && \
1313
apt-get update && \
1414
apt-get install -y libssl-dev && \
1515
apt-get clean
16-
CMD yarn run start:dev:${PACKAGE}
16+
CMD yarn run start:dev:${PACKAGE}

packages/common/.dockerignore

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
alice
2-
bob
3-
node_modules
4-
scripts
5-
test
6-
zero
7-
*.db
8-
charts
9-
helmfile.d
10-
build
11-
dist/*
1+
*
2+
!package.json
3+
!tsconfig.json
4+
!src
5+
!data

packages/core/.dockerignore

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
alice
2-
bob
3-
node_modules
4-
scripts
5-
test
6-
zero
7-
*.db
8-
charts
9-
helmfile.d
10-
build
1+
*
2+
!package.json
3+
!tsconfig.json
4+
!src
5+
!config

packages/telemetry/.dockerignore

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
alice
2-
bob
3-
node_modules
4-
scripts
5-
test
6-
zero
7-
*.db
8-
charts
9-
helmfile.d
10-
build
1+
*
2+
!package.json
3+
!tsconfig.json
4+
!src
5+
!config

packages/worker/.dockerignore

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
alice
2-
bob
3-
node_modules
4-
scripts
5-
test
6-
zero
7-
*.db
8-
charts
9-
helmfile.d
10-
build
1+
*
2+
!package.json
3+
!tsconfig.json
4+
!src
5+
!config

turbo.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
"$schema": "https://turbo.build/schema.json",
33
"pipeline": {
44
"build": {
5-
"outputs": [".next/**", "!.next/cache/**"]
6-
},
7-
"deploy": {
8-
"dependsOn": ["build", "test", "lint"]
5+
"outputs": ["build/**", "dist/**"]
96
},
107
"test": {
118
"inputs": ["src/**/*.tsx", "src/**/*.ts", "test/**/*.ts", "test/**/*.tsx"]

0 commit comments

Comments
 (0)