Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ services:
dockerfile: ./docker/php/Dockerfile
env_file: .env
restart: always
volumes:
- ./public/.vite:/var/www/html/public/.vite
- ./public/assets:/var/www/html/public/assets
networks:
- webifycms-site

Expand Down
23 changes: 22 additions & 1 deletion docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# ── Stage 1: Build frontend assets ──────────────────────────────
FROM node:24-alpine AS frontend

WORKDIR /build

# install dependencies first (layer cache)
COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund

# copy source files needed by Vite
COPY assets/ ./assets/
COPY vite.config.js ./

# build production assets
RUN npm run build

# ── Stage 2: PHP-FPM runtime ───────────────────────────────────
FROM php:8.4-fpm-alpine

# copy Composer binary into the container
Expand All @@ -18,6 +35,10 @@ RUN composer dump-autoload --classmap-authoritative --no-dev
# copy application source
COPY --chown=app:app . .

# copy built frontend assets from stage 1
COPY --from=frontend --chown=app:app /build/public/assets/ ./public/assets/
COPY --from=frontend --chown=app:app /build/public/.vite/ ./public/.vite/

# create non-root user
RUN addgroup -g 1000 -S app && adduser -u 1000 -S app -G app

Expand All @@ -32,4 +53,4 @@ USER app

# expose port 9000 and start php-fpm
EXPOSE 9000
CMD ["php-fpm"]
CMD ["php-fpm"]
7 changes: 0 additions & 7 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ fi
echo ">>> Pulling latest changes..."
git pull origin main

# Build frontend assets
echo ">>> Installing npm dependencies..."
npm ci --no-audit --no-fund

echo ">>> Building frontend assets..."
npm run build

# Stop existing containers
echo ">>> Stopping existing containers..."
docker compose down
Expand Down
Loading