From d577f332b68170ac82689fb8a980e2ef4db90eac Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:12:24 +0200 Subject: [PATCH 1/9] use website docker image --- docker-compose.yml | 8 +++++--- packages/website/Dockerfile | 16 +++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2879b8b6..973d5a97 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -82,9 +82,11 @@ services: - website website: - build: - context: ./packages/website - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/website/Dockerfile + image: skynetlabs/website container_name: website restart: unless-stopped logging: *default-logging diff --git a/packages/website/Dockerfile b/packages/website/Dockerfile index 3a9fa9a1..9477a4f6 100644 --- a/packages/website/Dockerfile +++ b/packages/website/Dockerfile @@ -4,16 +4,22 @@ RUN apk add --no-cache autoconf=2.71-r0 automake=1.16.4-r1 build-base=0.5-r2 lib WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/website/package.json packages/website/yarn.lock ./ ENV GATSBY_TELEMETRY_DISABLED 1 ENV CYPRESS_INSTALL_BINARY 0 RUN yarn --frozen-lockfile -COPY data ./data -COPY src ./src -COPY static ./static -COPY gatsby-browser.js gatsby-config.js gatsby-node.js gatsby-ssr.js postcss.config.js tailwind.config.js ./ +COPY packages/website/data ./data +COPY packages/website/src ./src +COPY packages/website/static ./static +COPY packages/website/gatsby-browser.js \ + packages/website/gatsby-config.js \ + packages/website/gatsby-node.js \ + packages/website/gatsby-ssr.js \ + packages/website/postcss.config.js \ + packages/website/tailwind.config.js \ + ./ RUN yarn build From 40b8390c193e519e4b564c3dea75d17ab1e94fec Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:38:19 +0200 Subject: [PATCH 2/9] use handshake-api docker image --- docker-compose.yml | 8 +++++--- packages/handshake-api/Dockerfile | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 973d5a97..1ab54e0f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -120,9 +120,11 @@ services: - 12037 handshake-api: - build: - context: ./packages/handshake-api - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/handshake-api/Dockerfile + image: skynetlabs/handshake-api container_name: handshake-api restart: unless-stopped logging: *default-logging diff --git a/packages/handshake-api/Dockerfile b/packages/handshake-api/Dockerfile index 92f30b36..2f6930b0 100644 --- a/packages/handshake-api/Dockerfile +++ b/packages/handshake-api/Dockerfile @@ -2,11 +2,11 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/handshake-api/package.json packages/handshake-api/yarn.lock ./ RUN yarn --frozen-lockfile -COPY src/* src/ +COPY packages/handshake-api/src/* src/ ENV HSD_NETWORK="main" ENV HSD_HOST="0.0.0.0" From 1d50d51f2987526256033fa73dfaa45b3be259f6 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:39:53 +0200 Subject: [PATCH 3/9] use dnslink-api docker image --- docker-compose.yml | 8 +++++--- packages/dnslink-api/Dockerfile | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1ab54e0f..153d6f16 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -144,9 +144,11 @@ services: - handshake dnslink-api: - build: - context: ./packages/dnslink-api - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/dnslink-api/Dockerfile + image: skynetlabs/dnslink-api container_name: dnslink-api restart: unless-stopped logging: *default-logging diff --git a/packages/dnslink-api/Dockerfile b/packages/dnslink-api/Dockerfile index be1f9452..fd477e87 100644 --- a/packages/dnslink-api/Dockerfile +++ b/packages/dnslink-api/Dockerfile @@ -2,11 +2,11 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/dnslink-api/package.json packages/dnslink-api/yarn.lock ./ RUN yarn --frozen-lockfile -COPY src/* src/ +COPY packages/dnslink-api/src/* src/ EXPOSE 3100 CMD ["node", "src/index.js"] From 73dad081eaf9a76b3c1de248fd2b3fdc8ef54021 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:41:18 +0200 Subject: [PATCH 4/9] use health-check docker image --- docker-compose.yml | 8 +++++--- packages/health-check/Dockerfile | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 153d6f16..5838f136 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -159,9 +159,11 @@ services: - 3100 health-check: - build: - context: ./packages/health-check - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/health-check/Dockerfile + image: skynetlabs/health-check container_name: health-check restart: unless-stopped logging: *default-logging diff --git a/packages/health-check/Dockerfile b/packages/health-check/Dockerfile index e9d15a77..cc4cb793 100644 --- a/packages/health-check/Dockerfile +++ b/packages/health-check/Dockerfile @@ -11,13 +11,13 @@ ENV PATH="/usr/app/bin:${PATH}" RUN echo '*/5 * * * * source /etc/environment ; /usr/app/bin/cli run critical >> /proc/1/fd/1' >> /etc/crontabs/root && \ echo '0 * * * * source /etc/environment ; /usr/app/bin/cli run extended >> /proc/1/fd/1' >> /etc/crontabs/root -COPY package.json yarn.lock ./ +COPY packages/health-check/package.json packages/health-check/yarn.lock ./ RUN yarn --frozen-lockfile -COPY src src -COPY cli cli -COPY bin bin +COPY packages/health-check/src src +COPY packages/health-check/cli cli +COPY packages/health-check/bin bin EXPOSE 3100 ENV NODE_ENV production From 7963c2cb63ee07817362e685f8134bf45cdffe02 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:47:49 +0200 Subject: [PATCH 5/9] use dashboard docker images --- docker-compose.accounts.yml | 16 ++++++++++------ packages/dashboard-v2/Dockerfile | 12 +++++++----- packages/dashboard/Dockerfile | 13 ++++++++----- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/docker-compose.accounts.yml b/docker-compose.accounts.yml index 73953a57..9fa4722d 100644 --- a/docker-compose.accounts.yml +++ b/docker-compose.accounts.yml @@ -55,9 +55,11 @@ services: - mongo dashboard: - build: - context: ./packages/dashboard - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/dashboard/Dockerfile + image: skynetlabs/dashboard container_name: dashboard restart: unless-stopped logging: *default-logging @@ -77,9 +79,11 @@ services: - mongo dashboard-v2: - build: - context: ./packages/dashboard-v2 - dockerfile: Dockerfile + # uncomment "build" and comment out "image" to build from sources + # build: + # context: https://github.com/SkynetLabs/skynet-webportal.git#master + # dockerfile: ./packages/dashboard-v2/Dockerfile + image: skynetlabs/dashboard-v2 container_name: dashboard-v2 restart: unless-stopped logging: *default-logging diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile index 70790cfa..eaa4d073 100644 --- a/packages/dashboard-v2/Dockerfile +++ b/packages/dashboard-v2/Dockerfile @@ -2,13 +2,15 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/dashboard-v2/package.json packages/dashboard-v2/yarn.lock ./ RUN yarn --frozen-lockfile -COPY static ./static -COPY src ./src -COPY gatsby*.js ./ -COPY postcss.config.js tailwind.config.js ./ +COPY packages/dashboard/static ./static +COPY packages/dashboard/src ./src +COPY packages/dashboard/gatsby*.js ./ +COPY packages/dashboard/postcss.config.js \ + packages/dashboard/tailwind.config.js \ + ./ CMD ["sh", "-c", "yarn build && yarn serve --host 0.0.0.0 -p 9000"] diff --git a/packages/dashboard/Dockerfile b/packages/dashboard/Dockerfile index 39707664..5d8d8391 100644 --- a/packages/dashboard/Dockerfile +++ b/packages/dashboard/Dockerfile @@ -2,14 +2,17 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY package.json yarn.lock ./ +COPY packages/dashboard/package.json packages/dashboard/yarn.lock ./ ENV NEXT_TELEMETRY_DISABLED 1 RUN yarn --frozen-lockfile -COPY public ./public -COPY src ./src -COPY styles ./styles -COPY .eslintrc.json postcss.config.js tailwind.config.js ./ +COPY packages/dashboard/public ./public +COPY packages/dashboard/src ./src +COPY packages/dashboard/styles ./styles +COPY packages/dashboard/.eslintrc.json \ + packages/dashboard/postcss.config.js \ + packages/dashboard/tailwind.config.js \ + ./ CMD ["sh", "-c", "env | grep -E 'NEXT_PUBLIC|STRIPE|ACCOUNTS' > .env.local && yarn build && yarn start"] From e8d68a0fa06db2f2f3959189c58c9b65e66108ae Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:51:12 +0200 Subject: [PATCH 6/9] clean up docker images --- packages/dashboard-v2/Dockerfile | 8 +++++--- packages/dashboard/Dockerfile | 4 +++- packages/dnslink-api/Dockerfile | 4 +++- packages/handshake-api/Dockerfile | 4 +++- packages/health-check/Dockerfile | 4 +++- packages/website/Dockerfile | 9 ++++----- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile index eaa4d073..4655767b 100644 --- a/packages/dashboard-v2/Dockerfile +++ b/packages/dashboard-v2/Dockerfile @@ -2,14 +2,16 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/dashboard-v2/package.json packages/dashboard-v2/yarn.lock ./ +COPY packages/dashboard-v2/package.json \ + packages/dashboard-v2/yarn.lock \ + ./ RUN yarn --frozen-lockfile COPY packages/dashboard/static ./static COPY packages/dashboard/src ./src -COPY packages/dashboard/gatsby*.js ./ -COPY packages/dashboard/postcss.config.js \ +COPY packages/dashboard/gatsby*.js \ + packages/dashboard/postcss.config.js \ packages/dashboard/tailwind.config.js \ ./ diff --git a/packages/dashboard/Dockerfile b/packages/dashboard/Dockerfile index 5d8d8391..25f584b3 100644 --- a/packages/dashboard/Dockerfile +++ b/packages/dashboard/Dockerfile @@ -2,7 +2,9 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/dashboard/package.json packages/dashboard/yarn.lock ./ +COPY packages/dashboard/package.json \ + packages/dashboard/yarn.lock \ + ./ ENV NEXT_TELEMETRY_DISABLED 1 RUN yarn --frozen-lockfile diff --git a/packages/dnslink-api/Dockerfile b/packages/dnslink-api/Dockerfile index fd477e87..9ded8cbf 100644 --- a/packages/dnslink-api/Dockerfile +++ b/packages/dnslink-api/Dockerfile @@ -2,7 +2,9 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/dnslink-api/package.json packages/dnslink-api/yarn.lock ./ +COPY packages/dnslink-api/package.json \ + packages/dnslink-api/yarn.lock \ + ./ RUN yarn --frozen-lockfile diff --git a/packages/handshake-api/Dockerfile b/packages/handshake-api/Dockerfile index 2f6930b0..211044c1 100644 --- a/packages/handshake-api/Dockerfile +++ b/packages/handshake-api/Dockerfile @@ -2,7 +2,9 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/handshake-api/package.json packages/handshake-api/yarn.lock ./ +COPY packages/handshake-api/package.json \ + packages/handshake-api/yarn.lock \ + ./ RUN yarn --frozen-lockfile diff --git a/packages/health-check/Dockerfile b/packages/health-check/Dockerfile index cc4cb793..15ef0086 100644 --- a/packages/health-check/Dockerfile +++ b/packages/health-check/Dockerfile @@ -11,7 +11,9 @@ ENV PATH="/usr/app/bin:${PATH}" RUN echo '*/5 * * * * source /etc/environment ; /usr/app/bin/cli run critical >> /proc/1/fd/1' >> /etc/crontabs/root && \ echo '0 * * * * source /etc/environment ; /usr/app/bin/cli run extended >> /proc/1/fd/1' >> /etc/crontabs/root -COPY packages/health-check/package.json packages/health-check/yarn.lock ./ +COPY packages/health-check/package.json \ + packages/health-check/yarn.lock \ + ./ RUN yarn --frozen-lockfile diff --git a/packages/website/Dockerfile b/packages/website/Dockerfile index 9477a4f6..dad0e393 100644 --- a/packages/website/Dockerfile +++ b/packages/website/Dockerfile @@ -4,7 +4,9 @@ RUN apk add --no-cache autoconf=2.71-r0 automake=1.16.4-r1 build-base=0.5-r2 lib WORKDIR /usr/app -COPY packages/website/package.json packages/website/yarn.lock ./ +COPY packages/website/package.json \ + packages/website/yarn.lock \ + ./ ENV GATSBY_TELEMETRY_DISABLED 1 ENV CYPRESS_INSTALL_BINARY 0 @@ -13,10 +15,7 @@ RUN yarn --frozen-lockfile COPY packages/website/data ./data COPY packages/website/src ./src COPY packages/website/static ./static -COPY packages/website/gatsby-browser.js \ - packages/website/gatsby-config.js \ - packages/website/gatsby-node.js \ - packages/website/gatsby-ssr.js \ +COPY packages/website/gatsby-*.js \ packages/website/postcss.config.js \ packages/website/tailwind.config.js \ ./ From 7707a34564102f430bc4548b56dd63cdfdb43c60 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:55:54 +0200 Subject: [PATCH 7/9] fix dashboard-v2 dockerfile --- packages/dashboard-v2/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile index 4655767b..4c834e0c 100644 --- a/packages/dashboard-v2/Dockerfile +++ b/packages/dashboard-v2/Dockerfile @@ -8,11 +8,11 @@ COPY packages/dashboard-v2/package.json \ RUN yarn --frozen-lockfile -COPY packages/dashboard/static ./static -COPY packages/dashboard/src ./src -COPY packages/dashboard/gatsby*.js \ - packages/dashboard/postcss.config.js \ - packages/dashboard/tailwind.config.js \ +COPY packages/dashboard-v2/static ./static +COPY packages/dashboard-v2/src ./src +COPY packages/dashboard-v2/gatsby*.js \ + packages/dashboard-v2/postcss.config.js \ + packages/dashboard-v2/tailwind.config.js \ ./ CMD ["sh", "-c", "yarn build && yarn serve --host 0.0.0.0 -p 9000"] From 8bdb64e745818207da0ab6fc32a4185c2358e2aa Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 14:57:53 +0200 Subject: [PATCH 8/9] build gatsby as a part of docker build process --- packages/dashboard-v2/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile index 4c834e0c..9fb4c604 100644 --- a/packages/dashboard-v2/Dockerfile +++ b/packages/dashboard-v2/Dockerfile @@ -15,4 +15,8 @@ COPY packages/dashboard-v2/gatsby*.js \ packages/dashboard-v2/tailwind.config.js \ ./ -CMD ["sh", "-c", "yarn build && yarn serve --host 0.0.0.0 -p 9000"] +RUN yarn build + +EXPOSE 9000 + +CMD ["sh", "-c", "yarn serve --host 0.0.0.0 -p 9000"] From 66cdd712f09d14be05784d4c110943d1b436a2eb Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 7 Apr 2022 15:16:25 +0200 Subject: [PATCH 9/9] revert using image for dashboard --- docker-compose.accounts.yml | 16 ++++++---------- packages/dashboard-v2/Dockerfile | 20 ++++++-------------- packages/dashboard/Dockerfile | 15 +++++---------- 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/docker-compose.accounts.yml b/docker-compose.accounts.yml index 9fa4722d..73953a57 100644 --- a/docker-compose.accounts.yml +++ b/docker-compose.accounts.yml @@ -55,11 +55,9 @@ services: - mongo dashboard: - # uncomment "build" and comment out "image" to build from sources - # build: - # context: https://github.com/SkynetLabs/skynet-webportal.git#master - # dockerfile: ./packages/dashboard/Dockerfile - image: skynetlabs/dashboard + build: + context: ./packages/dashboard + dockerfile: Dockerfile container_name: dashboard restart: unless-stopped logging: *default-logging @@ -79,11 +77,9 @@ services: - mongo dashboard-v2: - # uncomment "build" and comment out "image" to build from sources - # build: - # context: https://github.com/SkynetLabs/skynet-webportal.git#master - # dockerfile: ./packages/dashboard-v2/Dockerfile - image: skynetlabs/dashboard-v2 + build: + context: ./packages/dashboard-v2 + dockerfile: Dockerfile container_name: dashboard-v2 restart: unless-stopped logging: *default-logging diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile index 9fb4c604..70790cfa 100644 --- a/packages/dashboard-v2/Dockerfile +++ b/packages/dashboard-v2/Dockerfile @@ -2,21 +2,13 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/dashboard-v2/package.json \ - packages/dashboard-v2/yarn.lock \ - ./ +COPY package.json yarn.lock ./ RUN yarn --frozen-lockfile -COPY packages/dashboard-v2/static ./static -COPY packages/dashboard-v2/src ./src -COPY packages/dashboard-v2/gatsby*.js \ - packages/dashboard-v2/postcss.config.js \ - packages/dashboard-v2/tailwind.config.js \ - ./ +COPY static ./static +COPY src ./src +COPY gatsby*.js ./ +COPY postcss.config.js tailwind.config.js ./ -RUN yarn build - -EXPOSE 9000 - -CMD ["sh", "-c", "yarn serve --host 0.0.0.0 -p 9000"] +CMD ["sh", "-c", "yarn build && yarn serve --host 0.0.0.0 -p 9000"] diff --git a/packages/dashboard/Dockerfile b/packages/dashboard/Dockerfile index 25f584b3..39707664 100644 --- a/packages/dashboard/Dockerfile +++ b/packages/dashboard/Dockerfile @@ -2,19 +2,14 @@ FROM node:16.14.2-alpine WORKDIR /usr/app -COPY packages/dashboard/package.json \ - packages/dashboard/yarn.lock \ - ./ +COPY package.json yarn.lock ./ ENV NEXT_TELEMETRY_DISABLED 1 RUN yarn --frozen-lockfile -COPY packages/dashboard/public ./public -COPY packages/dashboard/src ./src -COPY packages/dashboard/styles ./styles -COPY packages/dashboard/.eslintrc.json \ - packages/dashboard/postcss.config.js \ - packages/dashboard/tailwind.config.js \ - ./ +COPY public ./public +COPY src ./src +COPY styles ./styles +COPY .eslintrc.json postcss.config.js tailwind.config.js ./ CMD ["sh", "-c", "env | grep -E 'NEXT_PUBLIC|STRIPE|ACCOUNTS' > .env.local && yarn build && yarn start"]