Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

CAMP realize breaks multistage Dockerfile #78

Closed
fchauvel opened this issue Sep 30, 2019 · 0 comments
Closed

CAMP realize breaks multistage Dockerfile #78

fchauvel opened this issue Sep 30, 2019 · 0 comments

Comments

@fchauvel
Copy link
Member

Characteristics

  • Issue Type: bug
  • Reproducibility: always
  • Severity: major
  • Tool/Service/Component: CAMP realize
  • Execution Environment: CAMP v0.6.2
    • Linux 4.9.0-8-amd64 (debian 9.8)
    • Python 3.5.3.final.0
    • Z3 4.7.1
    • Docker version 18.09.4, build d14af54
    • docker-compose version 1.23.0, build c8524dc1
  • Reporter: Franck Chauvel

Description

Folllowing the discussion from Issue #77 about recomposing software stacks, CAMP realize replaces every FROM statements from the Dockerfile, and therefore makes multi-stages build invalid.

Steps to reproduce

For instance, consider the java example from samples/java which we modify so that Tomcat has its own component in the camp.yml below:

 greetings:
    provides_services: [ Greetings ]
    requires_features: [ ServletContainer ]
    implementation:
      docker:
        file: greetings/Dockerfile

  tomcat:
    provides_features: [ ServletContainer ]
    requires_features: [ JRE ]
    variables:
      version:
	values: [ v7, v8, v9 ]
	realization:
         - targets: [ tomcat/Dockerfile ]
           pattern: "TOMCAT_MAJOR=7"
           replacements:
             - TOMCAT_MAJOR=7
             - TOMCAT_MAJOR=8
             - TOMCAT_MAJOR=9
         - targets: [ tomcat/Dockerfile ]
           pattern: "TOMCAT_REVISION=0.96"
           replacements:
             - TOMCAT_REVISION=0.96
             - TOMCAT_REVISION=5.46
             - TOMCAT_REVISION=0.26
    implementation:
      docker:
	file: tomcat/Dockerfile

  jre:
    provides_features: [ JRE ]
    implementation:
      docker:
	file: jre/Dockerfile

When we trigger CAMP realize, we get a wrong Dockerfile for the greetings service, which has two stages. See below, both FROM statements now points towards camp-tomcat_0, whereas only the second one should have been updated.

# Step 1: Build the WAR file                                                                                                                                                                                       
FROM camp-tomcat_0 as builder

LABEL maintainer "franck.chauvel@sintef.no"

RUN apt-get update && \
        apt-get install -y --no-install-recommends  \
        maven=3.3.9-4 && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN mkdir greetings
WORKDIR /greetings

COPY . /greetings
RUN mvn clean package
RUN mv target/greetings-1.0-SNAPSHOT.war target/greetings.war


# Step 2: Deploy the WAR file into a Tomcat instance                                                                                                                                                               
FROM camp-tomcat_0

COPY --from=builder /greetings/target/greetings.war /usr/local/tomcat/webapps/greetings.war

CMD ["catalina.sh", "run"]

Other files and URLs

Relationships

Help on issue template

Preview to follow the link or open file .github/ISSUE_DOC.md

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant