Skip to content
Andreas Ekström edited this page Jul 11, 2026 · 2 revisions

ViteWP currently doesnt distribute an official Docker image, however that might change in the near future. With that said ViteWP is developed with Docker in mind and running it ViteWP in an container is very easy.

You are welcome to copy and paste these example image files for now:

# Dockerfile
FROM node:22-bookworm

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
  && apt-get install -y --no-install-recommends \
    composer \
    git \
    php-cli \
    php-curl \
    php-mbstring \
    php-mysql \
    php-xml \
    php-zip \
    unzip \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

ENV COMPOSER_ALLOW_SUPERUSER=1
ENV NODE_ENV=production
ENV WP_URL=http://0.0.0.0:3000

COPY package*.json ./
RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi

COPY composer.* ./
RUN if [ -f composer.json ]; then composer install --no-interaction --prefer-dist; fi

COPY . .

EXPOSE 3000

CMD ["npm", "run", "dev"]
# Dockerfile.dev
FROM node:22-bookworm

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
  && apt-get install -y --no-install-recommends \
    composer \
    git \
    php-cli \
    php-curl \
    php-mbstring \
    php-mysql \
    php-xml \
    php-zip \
    unzip \
  && rm -rf /var/lib/apt/lists/*

WORKDIR /app

ENV COMPOSER_ALLOW_SUPERUSER=1
ENV NODE_ENV=development
ENV CHOKIDAR_USEPOLLING=true
ENV CHOKIDAR_INTERVAL=100
ENV WATCHPACK_POLLING=true

ENV WP_URL=http://0.0.0.0:3000

EXPOSE 3000

CMD ["sh", "-lc", "if [ ! -d node_modules ]; then npm install; fi; if [ -f composer.json ] && [ ! -d vendor ]; then composer install --no-interaction --prefer-dist; fi; npm run dev"]

Recommended .dockerignore:

.git
node_modules
vendor
dist
.astro
.vitewp

.env
.env.*
!.env.example

wordpress/public
wordpress/content/uploads
wordpress/content/debug.log
wordpress/content/vitewp-assets

Clone this wiki locally