Commit 4d0001c1 authored by Victor Garcia's avatar Victor Garcia Committed by Vic Garcia

Example: Multi-image builds with docker compose

parent fc0b479c
ARG SERVE_IMAGE
FROM ${SERVE_IMAGE}
# It serves as documentation only
# see https://docs.docker.com/engine/reference/builder/#expose
EXPOSE 5000
COPY public public
version: '3'
services:
# Our "app" service
hello:
image: "${CI_REGISTRY_IMAGE-local}/hello:${CI_COMMIT_SHORT_SHA-local}"
build:
context: "."
context: "app"
# build time arguments passed to docker
args:
SERVE_IMAGE: "${CI_REGISTRY_IMAGE-local}/serve:${CI_COMMIT_SHORT_SHA-local}"
ports:
- "5000:5000"
depends_on:
- serve # ensure serve is built first
# Base image
serve:
image: "${CI_REGISTRY_IMAGE-local}/serve:${CI_COMMIT_SHORT_SHA-local}"
build:
context: "serve"
\ No newline at end of file
# minimal linux distribution with official node image
FROM node:11-alpine
# Install the 'serve' npm package
RUN npm install -g serve
COPY public public
# It serves as documentation only
# see https://docs.docker.com/engine/reference/builder/#expose
EXPOSE 5000
# When the container starts, serve the public/ dir
ENTRYPOINT [ "serve", "-n", "public/" ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment