W
Wasp2d ago
InsOp

Ejected Dockerfile does not work

i have 16.1 and this is what i get:
FROM node:18.18.0-alpine3.17 AS node
FROM node AS base
RUN apk --no-cache -U upgrade # To ensure any potential security patches are applied.
FROM base AS server-builder
RUN apk add --no-cache python3 build-base libtool autoconf automake
WORKDIR /app
COPY src ./src
COPY package.json .
COPY package-lock.json .
COPY server .wasp/build/server
COPY sdk .wasp/out/sdk
RUN npm install && cd .wasp/build/server && npm install
COPY db/schema.prisma .wasp/build/db/
RUN cd .wasp/build/server && npx prisma generate --schema='../db/schema.prisma'
RUN cd .wasp/build/server && npm run bundle


FROM base AS server-production
RUN apk add --no-cache python3
ENV NODE_ENV production
WORKDIR /app
COPY --from=server-builder /app/node_modules ./node_modules
COPY --from=server-builder /app/.wasp/build/server/node_modules .wasp/build/server/node_modules
COPY --from=server-builder /app/.wasp/build/server/bundle .wasp/build/server/bundle
COPY --from=server-builder /app/.wasp/build/server/package*.json .wasp/build/server/
COPY db/ .wasp/build/db/
EXPOSE ${PORT}
WORKDIR /app/.wasp/build/server
ENTRYPOINT ["npm", "run", "start-production"]
FROM node:18.18.0-alpine3.17 AS node
FROM node AS base
RUN apk --no-cache -U upgrade # To ensure any potential security patches are applied.
FROM base AS server-builder
RUN apk add --no-cache python3 build-base libtool autoconf automake
WORKDIR /app
COPY src ./src
COPY package.json .
COPY package-lock.json .
COPY server .wasp/build/server
COPY sdk .wasp/out/sdk
RUN npm install && cd .wasp/build/server && npm install
COPY db/schema.prisma .wasp/build/db/
RUN cd .wasp/build/server && npx prisma generate --schema='../db/schema.prisma'
RUN cd .wasp/build/server && npm run bundle


FROM base AS server-production
RUN apk add --no-cache python3
ENV NODE_ENV production
WORKDIR /app
COPY --from=server-builder /app/node_modules ./node_modules
COPY --from=server-builder /app/.wasp/build/server/node_modules .wasp/build/server/node_modules
COPY --from=server-builder /app/.wasp/build/server/bundle .wasp/build/server/bundle
COPY --from=server-builder /app/.wasp/build/server/package*.json .wasp/build/server/
COPY db/ .wasp/build/db/
EXPOSE ${PORT}
WORKDIR /app/.wasp/build/server
ENTRYPOINT ["npm", "run", "start-production"]
now there is missing a lot of dirs so he fails at building the dockerfile: for example: sdk server db. Am I missing something?
3 Replies
kapa.ai
kapa.ai2d ago
Hi @InsOp. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources and your question, it seems you're encountering an issue with the Dockerfile generated by Wasp. Let me address your concerns: 1. The Dockerfile you've shared appears to be a custom or modified version, as it doesn't exactly match the default Dockerfile template used by Wasp. This could be the source of your issues. 2. The missing directories (sdk, server, db) that you're experiencing suggest that the build context for Docker might not be set correctly, or these directories are not present in the location where you're running the Docker build command. To resolve this issue, I recommend the following steps: 1. First, ensure you're running the docker build command from the root of your Wasp project, not from the .wasp/build directory. 2. If you've customized the Dockerfile, make sure you're following Wasp's guidelines for customization. As mentioned in the Wasp deployment documentation, you should create your custom Dockerfile in the project's root directory, and Wasp will append its contents to the bottom of the default Dockerfile. 3. To see what your project's (potentially combined) Dockerfile should look like, run:
wasp dockerfile

wasp dockerfile

This will show you the actual Dockerfile that Wasp generates for your project. 4. If you're still encountering issues, try running wasp build again to regenerate the build files, including the Dockerfile. 5. Make sure that the directories src, .wasp/build/server, .wasp/out/sdk, and db exist in your project structure as expected by the Dockerfile. If these steps don't resolve your issue, it's possible that there's a problem with how your project is structured or how Wasp is generating the build files. In that case, you might want to reach out to the Wasp community for more specific help. As mentioned in the documentation, you can join their Discord for further assistance. Remember, the Dockerfile and build process can be sensitive to project structure and Wasp version, so ensure you're using the latest stable version of Wasp and that your project structure matches what Wasp expects. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @InsOp, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
InsOp
InsOpOP2d ago
i could go into .wasp/out but then again, there is no package.json to copy from all the paths dont seem to be correct here. also .wasp/build/server doesnt exist. it must be .wasp/out/build/server oh i need to do wasp build
MEE6
MEE62d ago
Wohooo @InsOp, you just became a Waspeteer level 2!

Did you find this page helpful?