From c5e869fffd419584d4648692f778c754fc889863 Mon Sep 17 00:00:00 2001 From: Owen Truong <44269025+OwenTruong@users.noreply.github.com> Date: Sat, 1 Jul 2023 12:31:56 -0400 Subject: [PATCH 1/9] [MarmadileManteater] Dockerfile, changed node_modules to dist/web Co-authored-by: Emma --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ca3337b141c1e..56dc555ee18ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ COPY node_module[s] ./node_modules # git is needed for jinter RUN apk add git # don't rebuild if you don't have to -RUN if [ ! -d 'node_modules' ]; then yarn ci; fi +RUN if [ ! -d 'dist/web' ]; then yarn ci; fi ## Build Stage ## FROM node:18-alpine AS build From 86c240fa8dc02183ef66ad96b768d28a969a2627 Mon Sep 17 00:00:00 2001 From: Emma Date: Thu, 13 Jul 2023 16:35:22 -0400 Subject: [PATCH 2/9] Update Dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 56dc555ee18ed..aee04f0bcaa8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,6 @@ COPY package.json ./package.json COPY yarn.lock ./yarn.lock # copy `dist` if it exists already COPY dis[t]/web ./dist/ -COPY node_module[s] ./node_modules # git is needed for jinter RUN apk add git # don't rebuild if you don't have to From e5c56cfebc38fb33f936a1946c034659ed0b1bb2 Mon Sep 17 00:00:00 2001 From: OwenTruong <44269025+OwenTruong@users.noreply.github.com> Date: Mon, 21 Aug 2023 14:17:51 -0400 Subject: [PATCH 3/9] No conditional copy allowed in Docker so "COPY dist[t]/web ./dist/" will fail if dist/web does not exist --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index aee04f0bcaa8a..54a84dd370918 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,6 @@ FROM node:18-alpine AS dep WORKDIR /app COPY package.json ./package.json COPY yarn.lock ./yarn.lock -# copy `dist` if it exists already -COPY dis[t]/web ./dist/ # git is needed for jinter RUN apk add git # don't rebuild if you don't have to From 7300fec762cde59f33a1ae8b866f6e5345537d48 Mon Sep 17 00:00:00 2001 From: OwenTruong <44269025+OwenTruong@users.noreply.github.com> Date: Mon, 21 Aug 2023 14:42:05 -0400 Subject: [PATCH 4/9] removed unnecessary condition in run instruction and copying of /app/dist/web from dep, and specified that building image on Apple Silicon may be slow --- Dockerfile | 9 +++++---- README.md | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 54a84dd370918..cb5f46dd74d2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,15 +6,16 @@ COPY package.json ./package.json COPY yarn.lock ./yarn.lock # git is needed for jinter RUN apk add git -# don't rebuild if you don't have to -RUN if [ ! -d 'dist/web' ]; then yarn ci; fi +# There are no conditional copy instructions in Docker so it is not possible to copy ./dist/web if it already exist on host +RUN yarn ci ## Build Stage ## FROM node:18-alpine AS build WORKDIR /app COPY . . -COPY --from=dep /app/dis[t]/web ./dist/web -COPY --from=dep /app/node_module[s] ./node_modules +COPY --from=dep /app/node_modules ./node_modules + + # don't rebuild if you don't have to RUN if [ ! -d 'dist/web' ]; then yarn pack:web; fi diff --git a/README.md b/README.md index 5a3ba401d4654..1a74d454bcbb0 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ yarn pack:web ### Commands for the PWA Docker Image ```bash # 💨 Creates and runs the image locally. Add `--platform=linux/arm64` to docker build for ARM64 devices including Apple Silicon -docker build -t freetubecordova . # Warning, might take 10 minutes. +docker build -t freetubecordova . # Warning, yarn ci instruction may take a while on Apple Silicon docker run --name ftcordova -d -p 8080:80 freetubecordova # 🏃 Runs the image from Docker Hub. From 26a0d8ad5cec1018692e6160dcf20fdd460e0298 Mon Sep 17 00:00:00 2001 From: OwenTruong <44269025+OwenTruong@users.noreply.github.com> Date: Mon, 21 Aug 2023 14:44:33 -0400 Subject: [PATCH 5/9] moved comment up a line --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1a74d454bcbb0..c75f118d1fe7e 100644 --- a/README.md +++ b/README.md @@ -98,8 +98,8 @@ yarn pack:web ### Commands for the PWA Docker Image ```bash -# 💨 Creates and runs the image locally. Add `--platform=linux/arm64` to docker build for ARM64 devices including Apple Silicon -docker build -t freetubecordova . # Warning, yarn ci instruction may take a while on Apple Silicon +# 💨 Creates and runs the image locally. Add `--platform=linux/arm64` to docker build for ARM64 devices including Apple Silicon (might be slow to build on Mac) +docker build -t freetubecordova . docker run --name ftcordova -d -p 8080:80 freetubecordova # 🏃 Runs the image from Docker Hub. From be2aea285542a34a8c4779aec24efaa1a6412606 Mon Sep 17 00:00:00 2001 From: OwenTruong <44269025+OwenTruong@users.noreply.github.com> Date: Mon, 21 Aug 2023 15:09:12 -0400 Subject: [PATCH 6/9] removed unnecessary conditionals in build stage yarn pack:web --- Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index cb5f46dd74d2a..780a6eb799036 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,10 +14,7 @@ FROM node:18-alpine AS build WORKDIR /app COPY . . COPY --from=dep /app/node_modules ./node_modules - - -# don't rebuild if you don't have to -RUN if [ ! -d 'dist/web' ]; then yarn pack:web; fi +RUN yarn pack:web ## App Stage ## FROM nginx:latest as app From 6bbf92bbb0d21495f728c95c3161bf3ddc3cf887 Mon Sep 17 00:00:00 2001 From: OwenTruong <44269025+OwenTruong@users.noreply.github.com> Date: Thu, 31 Aug 2023 13:52:59 -0400 Subject: [PATCH 7/9] reverted changes from August 21st that removed the conditional copy and run statements --- Dockerfile | 12 ++++++++---- README.md | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 780a6eb799036..aee04f0bcaa8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,17 +4,21 @@ FROM node:18-alpine AS dep WORKDIR /app COPY package.json ./package.json COPY yarn.lock ./yarn.lock +# copy `dist` if it exists already +COPY dis[t]/web ./dist/ # git is needed for jinter RUN apk add git -# There are no conditional copy instructions in Docker so it is not possible to copy ./dist/web if it already exist on host -RUN yarn ci +# don't rebuild if you don't have to +RUN if [ ! -d 'dist/web' ]; then yarn ci; fi ## Build Stage ## FROM node:18-alpine AS build WORKDIR /app COPY . . -COPY --from=dep /app/node_modules ./node_modules -RUN yarn pack:web +COPY --from=dep /app/dis[t]/web ./dist/web +COPY --from=dep /app/node_module[s] ./node_modules +# don't rebuild if you don't have to +RUN if [ ! -d 'dist/web' ]; then yarn pack:web; fi ## App Stage ## FROM nginx:latest as app diff --git a/README.md b/README.md index c75f118d1fe7e..5a3ba401d4654 100644 --- a/README.md +++ b/README.md @@ -98,8 +98,8 @@ yarn pack:web ### Commands for the PWA Docker Image ```bash -# 💨 Creates and runs the image locally. Add `--platform=linux/arm64` to docker build for ARM64 devices including Apple Silicon (might be slow to build on Mac) -docker build -t freetubecordova . +# 💨 Creates and runs the image locally. Add `--platform=linux/arm64` to docker build for ARM64 devices including Apple Silicon +docker build -t freetubecordova . # Warning, might take 10 minutes. docker run --name ftcordova -d -p 8080:80 freetubecordova # 🏃 Runs the image from Docker Hub. From a81dc7df221edf88aaa4e5f7eac14ab9bb9e1ac0 Mon Sep 17 00:00:00 2001 From: OwenTruong <44269025+OwenTruong@users.noreply.github.com> Date: Thu, 31 Aug 2023 13:55:14 -0400 Subject: [PATCH 8/9] changed warning on local docker build to be Apple Silicon specific --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a3ba401d4654..a670ff23d25b8 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ yarn pack:web ### Commands for the PWA Docker Image ```bash # 💨 Creates and runs the image locally. Add `--platform=linux/arm64` to docker build for ARM64 devices including Apple Silicon -docker build -t freetubecordova . # Warning, might take 10 minutes. +docker build -t freetubecordova . # Warning, might take a while on Apple Silicon docker run --name ftcordova -d -p 8080:80 freetubecordova # 🏃 Runs the image from Docker Hub. From 20269ff736d90ae31e08bb6763ac6e53857c6d5a Mon Sep 17 00:00:00 2001 From: Owen Truong <44269025+OwenTruong@users.noreply.github.com> Date: Sat, 2 Sep 2023 21:12:24 -0400 Subject: [PATCH 9/9] Copying host's dist/web to container's dist/web instead of dist/ Co-authored-by: Emma --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index aee04f0bcaa8a..d81ffe3c01d3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /app COPY package.json ./package.json COPY yarn.lock ./yarn.lock # copy `dist` if it exists already -COPY dis[t]/web ./dist/ +COPY dis[t]/web ./dist/web # git is needed for jinter RUN apk add git # don't rebuild if you don't have to