nteract / commuter

🚎 Notebook sharing hub
BSD 3-Clause "New" or "Revised" License
495 stars 66 forks source link

Dockerfile build error occurred #297

Closed Swalloow closed 4 years ago

Swalloow commented 4 years ago

Hi, I was trying to build commuter Dockerfile using README - Deployment(Docker / Kubernetes). But its crashing with the error. (current master branch) (In Step 22/26 : COPY --from=build /opt/build/lib /opt/app/lib)

$ docker build --tag commuter:latest .

...

Step 14/26 : FROM node:14-slim as release
14-slim: Pulling from library/node
7d2977b12acb: Pull complete
23e9a36a6e2d: Pull complete
831103f0eed4: Pull complete
f172d5646bed: Pull complete
9f1d0c9b6ec5: Pull complete
Digest: sha256:4f837156a4bc43b6c8af7195dd7dbfc0b46e6f3515f777e2cb53139dc4faee33
Status: Downloaded newer image for node:14-slim
 ---> 0e2e78467169
Step 15/26 : ARG TINI_VERSION=v0.19.0
 ---> Running in 4836ccd74d2a
Removing intermediate container 4836ccd74d2a
 ---> a16189d2a516
Step 16/26 : ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
Downloading [==================================================>]  24.06kB/24.06kB
 ---> 4c2721dd250f
Step 17/26 : RUN chmod +x /tini
 ---> Running in cbcf7a102785
Removing intermediate container cbcf7a102785
 ---> 858f7ddf710a
Step 18/26 : ENV NODE_ENV='production'
 ---> Running in bd412983312a
Removing intermediate container bd412983312a
 ---> 435cc0d55635
Step 19/26 : RUN mkdir -p /opt/app
 ---> Running in 48c0d1f069b6
Removing intermediate container 48c0d1f069b6
 ---> 3b11f868b1df
Step 20/26 : WORKDIR /opt/app
 ---> Running in a9ab069bf4a1
Removing intermediate container a9ab069bf4a1
 ---> 378e74feb637
Step 21/26 : COPY --from=build /opt/build/.next /opt/app/.next
 ---> 06706ee64d62
Step 22/26 : COPY --from=build /opt/build/lib /opt/app/lib
 ---> 6741c33f4909
Step 23/26 : COPY --from=build /opt/build/public /opt/app/public
COPY failed: stat /var/lib/docker/overlay2/a2f3b43316d331f8603f392bb9e5a64d1ca63eb291c5048c41bdfaf88da70717/merged/opt/build/public: no such file or directory
carno commented 4 years ago

I encountered the same issue, looks like it is a result of https://github.com/nteract/commuter/commit/c03d5bb7359b347dcca0d9cd88842ed6525955f6 For some reason public/ was not moved into src/. If it was left out on purpose then Dockerfile needs adjusting e.g.:

diff --git a/Dockerfile b/Dockerfile
index 6a0d082..76d10d2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -68,7 +68,7 @@ WORKDIR /opt/app

 COPY --from=build /opt/build/.next /opt/app/.next
 COPY --from=build /opt/build/lib /opt/app/lib
-COPY --from=build /opt/build/public /opt/app/public
+COPY public /opt/app/public
 COPY --from=dependencies /opt/build/node_modules /opt/app/node_modules

 ENTRYPOINT ["/tini", "-g", "--"]

allows to build the image - not tested yet if it works, not sure if yarn steps require the static files to be present, I have very limited experience with js.

@groodt FYI

groodt commented 4 years ago

Apologies. Yes, the Dockerfile was broken after the nextjs refactor.

Fix on the way here: https://github.com/nteract/commuter/pull/302

For some reason public/ was not moved into src/. If it was left out on purpose then Dockerfile needs adjusting e.g.:

next doesn't want the public assets in src. 👍