Skip to content

Commit 875a9eb

Browse files
committed
feat: windows volume mount performace tuning
1 parent 7068b26 commit 875a9eb

File tree

9 files changed

+39
-23
lines changed

9 files changed

+39
-23
lines changed

admin/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# avoid unnecessary cypress download
44
FROM taitounited/cypress:3.2.0-node10
55
ARG SERVICE_DIR=.
6+
RUN apt-get -y update && apt-get -y install rsync # rsync for windows devs
67
WORKDIR /service
78
COPY ${SERVICE_DIR}/package.json \
89
${SERVICE_DIR}/package-lock.* \
@@ -13,4 +14,4 @@ ENV API_ROOT ''
1314
ENV API_URL /api
1415
RUN npm install --loglevel warn
1516
EXPOSE 8080
16-
CMD npm install; npm run start
17+
CMD eval $DC_COMMAND; npm install; npm run start
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# For local development
22
FROM adoptopenjdk/openjdk11-openj9:jdk-11.0.1.13-alpine-slim
33
ARG SERVICE_DIR=.
4+
RUN apk add --update-cache rsync # rsync for windows devs
45
WORKDIR /service
56
COPY ${SERVICE_DIR} /service
67
# ENV GRADLE_OPTS "--project-cache-dir /.gradle"
78
RUN ./gradlew
89
EXPOSE 8080
910
# TODO: how to use secrets file in application.yml
10-
CMD DATABASE_PASSWORD=$(cat /run/secrets/DATABASE_PASSWORD) ./gradlew run
11+
CMD eval $DC_COMMAND; DATABASE_PASSWORD=$(cat /run/secrets/DATABASE_PASSWORD) ./gradlew run

client/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# avoid unnecessary cypress download
44
FROM taitounited/cypress:3.2.0-node10
55
ARG SERVICE_DIR=.
6+
RUN apt-get -y update && apt-get -y install rsync # rsync for windows devs
67
WORKDIR /service
78
COPY ${SERVICE_DIR}/package.json \
89
${SERVICE_DIR}/package-lock.* \
@@ -13,4 +14,4 @@ ENV API_ROOT ''
1314
ENV API_URL /api
1415
RUN npm install --loglevel warn
1516
EXPOSE 8080
16-
CMD npm install; npm run start
17+
CMD eval $DC_COMMAND; npm install; npm run start

client/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const PWA_ICON_DIR = ASSETS_DIR + '/icon.png';
2020
const PUBLIC_PORT = process.env.COMMON_PUBLIC_PORT;
2121
const DEV_PORT = 8080;
2222
const DEV_POLL =
23-
process.env.HOST_UNAME == 'Darwin'
23+
process.env.HOST_UNAME == 'Darwin' && !process.env.DC_COMMAND
2424
? 2000
2525
: undefined;
2626

docker-compose.yaml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# NOTE: docker-compose taito plugin sets DC_PATH and DC_COMMAND to mitigate
2+
# slow volume mounts on Windows. They might also be used in some other purposes
3+
# in the future.
4+
15
version: '3.5'
26
services:
37
server-template-ingress:
@@ -22,10 +26,11 @@ services:
2226
ports:
2327
- "8080"
2428
volumes:
25-
- "./admin:/service:delegated"
26-
- "./shared:/service/shared:delegated"
27-
- "/service/node_modules"
29+
- "./admin:${DC_PATH}/service:delegated"
30+
- "./shared:${DC_PATH}/service/shared:delegated"
31+
- "${DC_PATH}/service/node_modules"
2832
environment:
33+
DC_COMMAND: ${DC_COMMAND}
2934
HOST_UNAME: ${taito_host_uname}
3035
COMMON_COMPANY: companyname
3136
COMMON_PROJECT: server-template
@@ -45,14 +50,15 @@ services:
4550
ports:
4651
- "8080"
4752
volumes:
48-
- "./client:/service:delegated"
49-
- "./shared:/service/shared:delegated"
50-
- "/service/node_modules"
53+
- "./client:${DC_PATH}/service:delegated"
54+
- "./shared:${DC_PATH}/service/shared:delegated"
55+
- "${DC_PATH}/service/node_modules"
5156
secrets:
5257
# NOTE: Database connection is for tests only
5358
- DATABASE_PASSWORD
5459
- EXAMPLE_SECRET
5560
environment:
61+
DC_COMMAND: ${DC_COMMAND}
5662
HOST_UNAME: ${taito_host_uname}
5763
COMMON_COMPANY: companyname
5864
COMMON_PROJECT: server-template
@@ -76,10 +82,11 @@ services:
7682
ports:
7783
- "8080"
7884
volumes:
79-
- "./graphql:/service:delegated"
80-
- "./shared:/service/shared:delegated"
81-
- "/service/node_modules"
85+
- "./graphql:${DC_PATH}/service:delegated"
86+
- "./shared:${DC_PATH}/service/shared:delegated"
87+
- "${DC_PATH}/service/node_modules"
8288
environment:
89+
DC_COMMAND: ${DC_COMMAND}
8390
COMMON_COMPANY: companyname
8491
COMMON_PROJECT: server-template
8592
COMMON_PUBLIC_PORT: 9999
@@ -106,14 +113,15 @@ services:
106113
ports:
107114
- "8080"
108115
volumes:
109-
- "./server:/service:delegated"
110-
- "./shared:/service/shared:delegated"
111-
- "/service/node_modules"
116+
- "./server:${DC_PATH}/service:delegated"
117+
- "./shared:${DC_PATH}/service/shared:delegated"
118+
- "${DC_PATH}/service/node_modules"
112119
secrets:
113120
- DATABASE_PASSWORD
114121
- S3_KEY_SECRET
115122
- EXAMPLE_SECRET
116123
environment:
124+
DC_COMMAND: ${DC_COMMAND}
117125
COMMON_COMPANY: companyname
118126
COMMON_PROJECT: server-template
119127
COMMON_PUBLIC_PORT: 9999
@@ -149,12 +157,13 @@ services:
149157
# TODO: Temporary hack for https://github.com/gatsbyjs/gatsby/issues/3721
150158
- "7463:8080"
151159
volumes:
152-
- "./www:/service:delegated"
153-
- "/service/node_modules"
154-
- "/service/site/node_modules"
160+
- "./www:${DC_PATH}/service:delegated"
161+
- "${DC_PATH}/service/node_modules"
162+
- "${DC_PATH}/service/site/node_modules"
155163
# FOR GATSBY ONLY:
156164
# - "/service/site/node_modules"
157165
environment:
166+
DC_COMMAND: ${DC_COMMAND}
158167
COMMON_PUBLIC_PORT: 9999
159168

160169
server-template-cache:

graphql/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# NOTE: npm libraries are installed inside container to speed up build
33
FROM node:10-alpine
44
ARG SERVICE_DIR=.
5+
RUN apk add --update-cache rsync # rsync for windows devs
56
WORKDIR /service
67
ENV NODE_ENV development
78
COPY ${SERVICE_DIR}/package.json \
@@ -10,4 +11,4 @@ COPY ${SERVICE_DIR}/package.json \
1011
/service/
1112
RUN npm install --loglevel warn
1213
EXPOSE 8080
13-
CMD npm install; npm run start
14+
CMD eval $DC_COMMAND; npm install; npm run start

server/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
# NOTE: npm libraries are installed inside container to speed up build
33
FROM node:10-alpine
44
ARG SERVICE_DIR=.
5+
RUN apk add --update-cache rsync # rsync for windows devs
56
WORKDIR /service
67
ENV NODE_ENV development
78
COPY ${SERVICE_DIR}/package.json \
89
${SERVICE_DIR}/package-lock.* \
910
/service/
1011
RUN npm install --loglevel warn
1112
EXPOSE 8080
12-
CMD npm install; npm run start
13+
CMD eval $DC_COMMAND; npm install; npm run start

worker/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# NOTE: npm libraries are installed inside container to speed up build
33
FROM node:10-alpine
44
ARG SERVICE_DIR=.
5+
RUN apk add --update-cache rsync # rsync for windows devs
56
WORKDIR /service
67
ENV NODE_ENV development
78
COPY ${SERVICE_DIR}/package.json \
@@ -10,4 +11,4 @@ COPY ${SERVICE_DIR}/package.json \
1011
/service/
1112
RUN npm install --loglevel warn
1213
EXPOSE 8080
13-
CMD npm install; npm run start
14+
CMD eval $DC_COMMAND; npm install; npm run start

www/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# avoid unnecessary cypress download
44
FROM taitounited/cypress:3.2.0-node10
55
ARG SERVICE_DIR=.
6+
RUN apt-get -y update && apt-get -y install rsync # rsync for windows devs
67
ENV NODE_ENV development
78

89
RUN mkdir /service && chown node:node /service
@@ -24,4 +25,4 @@ RUN mkdir -p /build && \
2425

2526
# Start development
2627
EXPOSE 8080
27-
CMD . ~/.bashrc && ./develop.sh
28+
CMD eval $DC_COMMAND; . ~/.bashrc && ./develop.sh

0 commit comments

Comments
 (0)