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

Commit 807f297

Browse files
authored
Merge pull request #2939 from w3f/yuri/dockerfile-rework
Dockerfile rework
2 parents d6a764f + e573cdc commit 807f297

File tree

9 files changed

+53
-130
lines changed

9 files changed

+53
-130
lines changed

.circleci/config.yml

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -171,44 +171,12 @@ 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
179-
buildGatewayImage:
180-
docker:
181-
- image: web3f/ci-commons:v3.2.3
182-
resource_class: xlarge
183-
steps:
184-
- checkout
185-
- setup_remote_docker
186-
- run:
187-
command: |
188-
/scripts/build-image.sh web3f/otv-gateway . --build-arg PACKAGE=gateway
189-
190-
buildTelemetryImage:
191-
docker:
192-
- image: web3f/ci-commons:v3.2.3
193-
resource_class: xlarge
194-
steps:
195-
- checkout
196-
- setup_remote_docker
197-
- run:
198-
command: |
199-
/scripts/build-image.sh web3f/otv-telemetry . --build-arg PACKAGE=telemetry
200-
201-
buildWorkerImage:
202-
docker:
203-
- image: web3f/ci-commons:v3.2.3
204-
resource_class: xlarge
205-
steps:
206-
- checkout
207-
- setup_remote_docker
208-
- run:
209-
command: |
210-
/scripts/build-image.sh web3f/otv-worker . --build-arg PACKAGE=worker
211-
212180
integrationTests:
213181
docker:
214182
- image: web3f/ci-commons:v3.2.3
@@ -344,21 +312,6 @@ workflows:
344312
filters:
345313
tags:
346314
only: /.*/
347-
- buildGatewayImage:
348-
context: dockerhub-bot
349-
filters:
350-
tags:
351-
only: /.*/
352-
- buildTelemetryImage:
353-
context: dockerhub-bot
354-
filters:
355-
tags:
356-
only: /.*/
357-
- buildWorkerImage:
358-
context: dockerhub-bot
359-
filters:
360-
tags:
361-
only: /.*/
362315
- integrationTests:
363316
filters:
364317
tags:

.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)