r2d2bzh / docker-build-nodejs Goto Github PK
View Code? Open in Web Editor NEWDevelopment and production Docker images for your NodeJS based application
Development and production Docker images for your NodeJS based application
Hello there,
In some specific cases, our application needs to check the instance of an object.
eg
if (error instanceof SpecificError) return handleSpecific(error);
throw error;
Though, the current esbuild setup of docker-build-nodejs can append a number to the constructor names.
As described in this esbuild issue, the esbuild option --keep-names
avoids this behavior.
Would it be possible to enable this option by default?
Describe the bug
Buildkit does not support ONBUILD COPY --from
as described here.
This technique is used to transfer the build result from the builder
image to the runtime
image.
To Reproduce
The project test builds fail with buildkit enabled
Expected behavior
If buildkit fails to support the ONBUILD COPY --from
feature, a refactor is needed to support buildkit builds.
Logs
❯ docker compose --profile=test build
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
[+] Building 0.1s (1/2)
[+] Building 0.1s (0/1)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 0.0s
[+] Building 0.1s (1/1)
[+] Building 0.1s (0/1)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 0.0s
[+] Building 0.1s (1/1)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.1s (1/2)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.1s (1/1)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.1s (2/2)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 31B 0.0s
[+] Building 0.1s (1/1)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.1s (0/2)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.1s (0/1)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.1s (0/2)
[+] Building 0.3s (1/2)
=> [internal] load build definition from Dockerfile 0.0s
[+] Building 0.2s (1/2)
[+] Building 0.2s (1/2)
[+] Building 0.2s (1/2)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.2s (1/2)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.2s (1/2)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.2s (1/2)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 32B 0.0s
[+] Building 0.3s (1/2)
=> [internal] load build definition from Dockerfile 0.0s
[+] Building 0.3s (1/2)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.3s (1/2)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.3s (1/2)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.4s (3/6)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 178B 0.0s
=> [internal] load .dockerignore 0.2s
[+] Building 0.3s (1/2)
[+] Building 0.4s (2/3)
[+] Building 0.4s (2/2)
[+] Building 0.4s (3/3)
[+] Building 0.5s (5/13)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 249B 0.0s
=> [internal] load .dockerignore 0.2s
=> => transferring context: 56B 0.0s
[+] Building 0.6s (3/6)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 178B 0.0s
[+] Building 0.5s (3/12)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.2s
[+] Building 0.5s (2/4)
=> [internal] load build definition from Dockerfile 0.1s
[+] Building 0.4s (2/3)
[+] Building 0.5s (4/6)
=> => transferring dockerfile: 217B 0.0s
=> [internal] load .dockerignore 0.3s
=> => transferring context: 56B 0.0s
[+] Building 0.7s (6/8)
=> [internal] load build definition from Dockerfile 0.2s
[+] Building 0.7s (5/6)
[+] Building 1.1s (6/6)
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 201B 0.0s
=> [internal] load .dockerignore 0.3s
=> => transferring context: 64B 0.0s
=> [internal] load metadata for ghcr.io/r2d2bzh/docker-build-nodejs-runt 0.0s
=> [stage-2 1/1] FROM ghcr.io/r2d2bzh/docker-build-nodejs-runtime:dev 0.3s
=> [builder 1/1] FROM ghcr.io/r2d2bzh/docker-build-nodejs-builder:dev 0.6s
=> [internal] load build context 0.1s
=> [internal] load .dockerignore 0.3s
=> => transferring context: 56B 0.0s
=> [internal] load .dockerignore 0.3s
=> => transferring context: 56B 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [stage-2 2/1] COPY --from=builder /tmp/service / 0.0s
=> [internal] load metadata for ghcr.io/r2d2bzh/docker-build-nodejs-runt 0.0s
=> [stage-2 1/1] FROM ghcr.io/r2d2bzh/docker-build-nodejs-runtime:dev 0.3s
[+] Building 1.0s (6/6) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 178B 0.0s
=> [internal] load .dockerignore 0.3s
=> [stage-2 1/1] FROM ghcr.io/r2d2bzh/docker-build-nodejs-runtime:dev 0.3s
=> [internal] load metadata for ghcr.io/r2d2bzh/docker-build-nodejs-runt 0.0s
=> ERROR [stage-2 2/1] COPY --from=builder /tmp/service / 0.0s
=> [internal] load build definition from Dockerfile 0.2s
=> => transferring dockerfile: 207B 0.0s
=> [internal] load .dockerignore 0.3s
=> => transferring context: 2B 0.0s
=> => transferring context: 56B 0.0s
=> [internal] load metadata for ghcr.io/r2d2bzh/docker-build-nodejs-runt 0.0s
=> [internal] load metadata for ghcr.io/r2d2bzh/docker-build-nodejs-runt 0.0s
[+] Building 1.0s (7/8)
=> [internal] load build definition from Dockerfile 0.2s
=> => transferring dockerfile: 201B 0.0s
=> [internal] load .dockerignore 0.3s
=> => transferring context: 64B 0.0s
=> [internal] load .dockerignore 0.3s
=> [stage-2 1/1] FROM ghcr.io/r2d2bzh/docker-build-nodejs-runtime:dev 0.3s
=> => transferring context: 56B 0.0s
=> [internal] load metadata for ghcr.io/r2d2bzh/docker-build-nodejs-runt 0.0s
=> [stage-2 1/1] FROM ghcr.io/r2d2bzh/docker-build-nodejs-runtime:dev 0.3s
=> [builder 1/1] FROM ghcr.io/r2d2bzh/docker-build-nodejs-builder:dev 0.6s
=> ERROR [stage-2 2/1] COPY --from=builder /tmp/service / 0.0s
------age-2 2/1] COPY --from=builder /tmp/service /:vice / 0.0s
[+] Building 1.1s (6/6) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 178B 0.0s
=> [internal] load .dockerignore 0.2s
=> => transferring context: 67B 0.0s
=> [internal] load metadata for ghcr.io/r2d2bzh/docker-build-nodejs-runt 0.0s
=> [builder 1/1] FROM ghcr.io/r2d2bzh/docker-build-nodejs-builder:dev 0.6s
[+] Building 1.1s (7/13)
[+] Building 1.4s (8/13)
[+] Building 1.8s (7/7) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 31B 0.0s
=> [internal] load .dockerignore 0.2s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for ghcr.io/r2d2bzh/docker-build-nodejs-deve 0.0s
=> [1/1] FROM ghcr.io/r2d2bzh/docker-build-nodejs-devenv:dev 0.3s
=> [2/1] RUN echo "del:x:1000:100::/home/user:" >> /etc/passwd & 0.3s
=> [3/1] WORKDIR /home/user/dev 0.0s
=> exporting to image 0.8s
=> => exporting layers 0.7s
=> => writing image sha256:5f0565ec3ecddc9bd55205227c86ba9677493bbee3d86 0.0s
=> => naming to docker.io/library/docker-build-nodejs-dev 0.0s
failed to solve: failed to compute cache key: "/tmp/service" not found: not found
Desktop (please complete the following information):
uname -a
output: Linux hepao 6.2.0 NixOS SMP PREEMPT_DYNAMIC Sun Feb 19 22:24:22 UTC 2023 x86_64 GNU/Linuxdocker --version
output: Docker version 20.10.23, build v20.10.23docker-compose --version
output: Docker Compose version 2.16.0Additional context
The only workaround for now is to disable buildkit, i.e.:
DOCKER_BUILDKIT=0 docker compose --profile=test build
Describe the bug
When using the devenv
image with rootless docker, it tries to create a new user inside the container with the same UID and GID as the user operating the build on the host (UID & GID environment variables).
This fails because rootless docker maps container users uids & gids to non existing ids on the host to avoid collision with host users and groups.
To Reproduce
Build the image of the dev
service and start an instance of the service with:
docker-compose run --entrypoint=sh dev
In the container look at the permissions of the files mounted in /home/user
, they are all owned by root
.
You cannot for instance operate a npm install
because npm
is unable to create node_modules
.
Expected behavior
The project files under /home/user
should be owned by the host user.
In fact, there is no more need for an additional user in the container with rootless docker (root is mapped to the host user).
Logs
N/A
Desktop (please complete the following information):
uname -a
output: Linux ca0dd53cdadc 6.2.0 NixOS SMP PREEMPT_DYNAMIC Sun Feb 19 22:24:22 UTC 2023 x86_64 Linuxdocker --version
output: Docker version 20.10.23, build v20.10.23docker-compose --version
output: Docker Compose version 2.16.0Additional context
N/A
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.