Rock8Cloud

Dockerfile Requirements

What you need in your Dockerfile to deploy on Rock8Cloud

Rock8Cloud deploys any application that has a valid Dockerfile. Here's what you need.

Requirements

Your Dockerfile must:

  1. Build successfully - docker build . works without errors
  2. Expose a port - Use EXPOSE <port> instruction
  3. Start automatically - Use CMD or ENTRYPOINT

Example

Here's a real-world example from astro-rocketship:

# Build stage
FROM oven/bun:1.3.4-alpine AS builder
WORKDIR /app

COPY package.json bun.lock ./
RUN bun install --frozen-lockfile

COPY . .
RUN bun run build

# Production stage
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

This multi-stage build:

  • Builds the app with Bun
  • Serves static files with nginx
  • Results in a small, production-ready image

Port Configuration

The port in your Dockerfile must match what you configure in Rock8Cloud:

Dockerfile:

EXPOSE 3000

Rock8Cloud service settings:

  • Port: 3000

If they don't match, health checks will fail.


Test Locally First

Before deploying, verify your Dockerfile works:

# Build
docker build -t my-app .

# Run
docker run -p 3000:3000 my-app

# Test
curl http://localhost:3000

If it works locally, it'll work on Rock8Cloud.


Monorepo Setup

If your Dockerfile is in a subdirectory, you have two options for build context:

Option 1: Build from repository root (default)

Your Dockerfile references paths from the repo root:

# backend/Dockerfile
FROM node:20-alpine
WORKDIR /app

# Copy from repo root
COPY backend/package.json backend/package-lock.json ./
RUN npm install

COPY backend/ .
RUN npm run build

EXPOSE 3000
CMD ["node", "dist/index.js"]

Option 2: Build from Dockerfile directory

Enable "Use Dockerfile directory as build context" in service settings. Your Dockerfile uses relative paths:

# backend/Dockerfile
FROM node:20-alpine
WORKDIR /app

# Copy from backend/ directory
COPY package.json package-lock.json ./
RUN npm install

COPY . .
RUN npm run build

EXPOSE 3000
CMD ["node", "dist/index.js"]

This option is useful when:

  • Each service is self-contained in its folder
  • You want faster builds (smaller context)
  • Your Dockerfile already uses COPY . .

Common Issues

ProblemSolution
Build failsRun docker build . locally to see errors
App not accessibleCheck your app binds to the correct port
Health check failsEnsure port matches between Dockerfile and settings
Missing filesCheck all COPY paths exist and aren't in .dockerignore
Wrong files copiedCheck build context setting matches your Dockerfile's COPY paths

See FAQ for more help.

On this page