Magic Apps
Dockerfile
Build an app from your own Dockerfile instead of Railpack.
If the repository has a Dockerfile, Dcubix builds the app with it instead of Railpack. Use one when you need full control of the image, or for a framework Railpack doesn’t start correctly.
A minimal Dockerfile
FROM node:22-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 8080
CMD ["node", "server.js"]The port
Your app should listen on the port in PORT, on 0.0.0.0. With a single EXPOSE and no port set in the app’s settings, PORT is the exposed port. See The port.
Commands
The image’s CMD runs when nothing else sets a command. A Procfile line or a command set in the dashboard replaces it, and runs with /bin/sh -c, so the image needs /bin/sh for those. Distroless and scratch images can only run their own CMD.
The release command works the same as with Railpack: set it in the Procfile’s release: line or in the dashboard.
Build variables
Environment variables scoped to the build reach a Dockerfile build as build arguments. Declare each one you use with ARG:
ARG VITE_API_URL
RUN npm run buildWhen the build fails
The deploy’s error names the step that failed, and the log shows its last lines. A common one is a COPY of a file the repository doesn’t have, such as package-lock.json in a repository that uses pnpm-lock.yaml.
Paths to avoid
If a process has a volume, it can’t be mounted at /app, where most images keep their code. A path under it, such as /app/data, is fine. If your WORKDIR is somewhere else, don’t mount a volume over it: the volume starts empty and hides what the image has there.