Skaffold: Skaffold throws an error for multi stage builds

Created on 29 Aug 2018  路  4Comments  路  Source: GoogleContainerTools/skaffold

Expected behavior

The docker image should get built

Actual behavior

Dies with the error:

Error parsing reference: "node:alpine AS base" is not a valid repository/tag: invalid reference format 

Information

  • Skaffold version: v0.11.0
  • Operating system: jenkins x devpod
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1alpha2
kind: Config
build:
  tagPolicy:
    envTemplate:
      template: "{{.DOCKER_REGISTRY}}/heroic/destiny:{{.VERSION}}"
  artifacts:
  - imageName: destiny
    workspace: .
    docker: {}
  local: {}
deploy:
  kubectl:
    manifests:
profiles:
- name: dev
  build:
    tagPolicy:
      envTemplate:
        template: "{{.DOCKER_REGISTRY}}/heroic/destiny:{{.DIGEST_HEX}}"
    artifacts:
    - docker: {}
    local: {}
  deploy:
    helm:
      releases:
      - name: destiny
        chartPath: charts/destiny
        setValueTemplates:
          image.repository: "{{.DOCKER_REGISTRY}}/heroic/destiny"
          image.tag: "{{.TAG}}"

Steps to reproduce the behavior

  1. create a jenkins x devpod
  2. sync the default nodejs quickstart
  3. edit the dockerfile to these contents:
#
# ---- Base Node ----
FROM node:alpine as base
WORKDIR /usr/src/app
COPY ./package.json ./
COPY ./yarn.lock ./
ENV PORT 8080
EXPOSE 8080

#
# ---- Dependencies ----
FROM base AS dependencies
# install node packages
RUN apk add --no-cache postgresql-dev python g++ make \
    && yarn install --prod --silent \
    && cp -R node_modules prod_node_modules \
    && apk del python g++ make

#
# ---- Release ----
FROM base AS release
# copy production node_modules
CMD node ./index.js
COPY --from=dependencies /app/prod_node_modules ./node_modules
COPY . .
  1. skaffold dies
arebuild kinbug

Most helpful comment

@dgageot I figured this out. Turns out this wasn't a skaffold issue but GKE, which runs docker version 17.03 on the cluster. Docker 17.03 does not support multi stage builds

All 4 comments

might be linked to #502

@heroic I can't reproduce your issue. Do you by chance have an open-source project to test? Or maybe you could come up with a simpler project that has the same issue.

@heroic also, could you provide the full output of the command?

@dgageot I figured this out. Turns out this wasn't a skaffold issue but GKE, which runs docker version 17.03 on the cluster. Docker 17.03 does not support multi stage builds

Was this page helpful?
0 / 5 - 0 ratings

Related issues

strikeout picture strikeout  路  4Comments

nathkn picture nathkn  路  3Comments

emichaf picture emichaf  路  4Comments

achedeuzot picture achedeuzot  路  3Comments

abatilo picture abatilo  路  4Comments