Say I have the following dockerfile:
# Build
# -----------------------------------------------------------------------------
FROM node:12.18.4 AS build
WORKDIR /app
RUN mkdir -p /app
COPY package.json yarn.lock .npmrc ./
RUN yarn install --no-progress --frozen-lockfile
COPY . .
# Release
# -----------------------------------------------------------------------------
FROM node:12-alpine AS release
RUN \
addgroup -S -g 1001 example && \
adduser -S -G example -u 1001 example && \
mkdir /app && \
chown example:example /app
WORKDIR /app
USER example
COPY --chown=example:example --from=build /app .
CMD ["./node_modules/.bin/ts-node", "--transpile-only", "./bin/http.ts"]
# Worker
# -----------------------------------------------------------------------------
FROM node:12-alpine AS worker
RUN \
addgroup -S -g 1001 example && \
adduser -S -G example -u 1001 example && \
mkdir /app && \
chown example:example /app
WORKDIR /app
USER example
COPY --chown=example:example --from=build /app .
CMD ["./node_modules/.bin/ts-node", "--transpile-only", "./bin/worker.ts"]
And the following deployment.yml:
...
...
template:
metadata:
labels:
app: example
spec:
containers:
- name: example
image: example
...
...
How do I tell this deployment.yml which docker target I want it to build (release vs worker), and, therefore, spin up two k8 containers.