Reputation: 133
I'm on Mac M1 and using Colima for a replacement for Docker Desktop. I use Vite as bundler.
I did docker-compose up
and then got
Error:
You installed esbuild for another platform than the one you're currently using.
This won't work because esbuild is written with native code and needs to
install a platform-specific binary executable.
which didn't make a lot of sense to me as I wasn't copying my node_modules
folder. If I did, I would have understood why the @esbuild/darwin-arm6
package is installed on my machine but container needs @esbuild/linux-x64
. I'm only copying
COPY package.json package-lock.json .npmrc ./
on my Dockerfile
and running this one line later:
RUN --mount=type=secret,id=npmrc,dst=/usr/src/app/.npmrc \
--mount=type=cache,id=npmcache,target=/var/.npm \
npm ci --only=production --no-optional --prefer-offline --cache /var/.npm
so I would expect the container to be created, package files to be copied and node_modules
to be created with npm ci
.
When I run colima ssh
, I see that the files are identical to the host/local file system. I thought when I specify it with
volumes:
- .:/usr/src/app
and
node_modules/
on .dockerignore
, I'm basically saying that "check the .dockerignore
file, don't touch the folders there, move to Dockerfile
, copy package.json
and package-lock.json
and run npm ci
and apply the volumes which is basically taking the project directory and 'sync'ing it to the path /usr/src/app
inside the container", according to the article here which describes the order of execution:
When we run docker-compose up or any variation of the command, first the docker-compose command is converted into a docker command. Next, the .dockerignore is read and any files in there are ignored. After that, the Dockerfile is read. Of course when we do COPY . . we only copy the files that Docker did not ignore. Then, any volumes are applied, including bind mounts. The volumes do not adhere to the .dockerignore. Finally, if there is a command specified in the docker-compose.yml, that command is run.
But then again, when I do colima ssh
, I simply am not inside a docker container but still my local file system. (I can navigate and can visit any path outside of the project files). Also, when a modify a file, I can observe the file change locally. Besides, I also see the the supposedly ignored files in .dockerignore
there (like dist/
) I must be missing aomething fundamental.
I have started colima with
colima start --arch x86_64 --cpu 6 --memory 16 --disk 128 --cpu-type qemu64
Upvotes: 1
Views: 1052