Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockerfile does not complete, saying "Docker Deployed" #155

Closed
hubingkang opened this issue Jun 21, 2024 · 11 comments
Closed

dockerfile does not complete, saying "Docker Deployed" #155

hubingkang opened this issue Jun 21, 2024 · 11 comments
Labels
bug Something isn't working workaround

Comments

@hubingkang
Copy link

hubingkang commented Jun 21, 2024

To Reproduce

dockerfile does not complete, saying "Docker Deployed"

Current vs. Expected behavior

image

Complete all dockerfile steps

Provide environment information

FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
WORKDIR /app

FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build

FROM base
COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/dist /app/dist
EXPOSE 8000
CMD [ "pnpm", "start" ]

Which area(s) are affected? (Select all that apply)

Docker

Additional context

Docker version 26.0.0, build 2ae903e

@hubingkang hubingkang added the bug Something isn't working label Jun 21, 2024
@Siumauricio
Copy link
Contributor

Siumauricio commented Jun 22, 2024

The dockerfile looks good

  1. does the application run once the build is finished?
  2. Have you checked if that same image works for you locally first?

@hubingkang
Copy link
Author

There is an error during docker deployment, but this log does not see the error message

@Siumauricio
Copy link
Contributor

We use the native docker builder, so surely there is some error or suddenly we are not showing some important log that shows the error but for that I would need the following:

  1. minimum repository with the minimum things to be able to test and reproduce the problem.

@thenglong
Copy link

@hubingkang Did you find a solution for this? I face the same issue at RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

@Siumauricio
Copy link
Contributor

@hubingkang Can you share the dockerfile and the project you are building?

@hubingkang
Copy link
Author

hubingkang commented Jun 27, 2024

@thenglong @Siumauricio I didn't use the dockerfile from pnpm

FROM node:20-slim AS base

RUN npm install -g pnpm

WORKDIR /app
COPY package.json pnpm-lock.yaml .npmrc ./
RUN pnpm install
COPY . .
RUN pnpm run build

Make sure you have the "package.json pnpm-lock.yaml.npmrc" files. If not, you'll get the same problem as above, but you won't see an error message.

@thenglong
Copy link

This is weird because I ran build dockerfile from pnpm instruction manually works but via Dokploy didn't. This is the line in Dockerfile that causes the problem in Dokploy

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

@thenglong
Copy link

@hubingkang Shall we reopen this?

@hubingkang hubingkang reopened this Jun 27, 2024
@hubingkang
Copy link
Author

This is weird because I ran build dockerfile from pnpm instruction manually works but via Dokploy didn't. This is the line in Dockerfile that causes the problem in Dokploy

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

Similarly, I successfully deployed it using docker directly on my computer

@Siumauricio
Copy link
Contributor

It seems that the problem does not come from dokploy but from something external, checking very carefully in the logs locally it seems that it is something related to BuildKit that needs to be activated and comes from the dockerode library which we use to build the images when you use the Docker provider, according to investigating there seems to be an open issue about this,

Screenshot 2024-06-27 at 12 33 51 AM

apocas/dockerode#601
testcontainers/testcontainers-node#571

A solution will be to remove the --mount=type=cache

and use like this https://github.com/Dokploy/swarm-test/tree/dockerfile

FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
WORKDIR /app

FROM base AS prod-deps
RUN pnpm install --prod --frozen-lockfile

FROM base AS build
RUN pnpm install --frozen-lockfile
RUN pnpm run build

FROM base
COPY --from=prod-deps /app/node_modules /app/node_modules
EXPOSE 3000
CMD [ "pnpm", "start" ]

@Siumauricio
Copy link
Contributor

Since this is more of a dockerode issue, we can close it for now, when the issue is resolved we will update and the problem should go away, anyways there is a workaround for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working workaround
Projects
None yet
Development

No branches or pull requests

3 participants