Skip to main content
Build Features

FAQ about build features and capabilities.

Updated over a year ago

Can I create a multi-stage build?

Absolutely. An image can be defined in a build step at any point during the build. Assign a name using the stage property.

components:
- name: WebsiteStatic
type: service
image: node:18-alpine
build:
steps:
- copy: package*.json
destination: ./
- run: npm ci
- copy: index.html
- copy: vite.config.js
- copy: public/
- copy: src/
- run: npm run build
- image: nginx:1-alpine
stage: nginx
- copy: dist
destination: /usr/share/nginx/html/
from: main
- copy: nginx.conf
destination: /etc/nginx
runtime:
command: 'nginx -g "daemon off;"'
variables:
NGINX_ENTRYPOINT_QUIET_LOGS: '1'

How can I copy from the original build image?

The original build image receives the main stage name. See the from property in the following build step

        - copy: dist 
destination: /usr/share/nginx/html/
from: main
Did this answer your question?