Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Docker] Dockerfile build error: module swagger-generator is missing #7706

Open
Gingonic opened this issue Feb 21, 2018 · 3 comments
Open

[Docker] Dockerfile build error: module swagger-generator is missing #7706

Gingonic opened this issue Feb 21, 2018 · 3 comments

Comments

@Gingonic
Copy link
Contributor

Description

The dockerfile removes the generation of the swagger-generator, which produces "module not found" compilation error when the docker file is run alone.

@jimschubert was there a specific reason why you explicitly removed it?

# NOTE: swagger-generator is not included here, it is available as swaggerapi/swagger-generator

The Dockerfile really should run on it's own, so without going through one of the building platforms as it makes contributing a lot (I cannot state this enough) easier for those of us who do not originally code in java

Swagger-codegen version

master

Command line used for generation

Docker build alone so:

docker build .
Steps to reproduce

checkout master and run docker build .

Suggest a fix/enhancement

Dockerfile

FROM jimschubert/8-jdk-alpine-mvn:1.0

RUN set -x && \
    apk add --no-cache bash

ENV GEN_DIR /opt/swagger-codegen
WORKDIR ${GEN_DIR}
VOLUME  ${MAVEN_HOME}/.m2/repository

# Required from a licensing standpoint
COPY ./LICENSE ${GEN_DIR}

# Required to compile swagger-codegen
COPY ./google_checkstyle.xml ${GEN_DIR}

# Modules are copied individually here to allow for caching of docker layers between major.minor versions
COPY ./modules/swagger-codegen-maven-plugin ${GEN_DIR}/modules/swagger-codegen-maven-plugin
COPY ./modules/swagger-codegen-cli ${GEN_DIR}/modules/swagger-codegen-cli
COPY ./modules/swagger-codegen ${GEN_DIR}/modules/swagger-codegen
COPY ./modules/swagger-generator ${GEN_DIR}/modules/swagger-generator
COPY ./pom.xml ${GEN_DIR}

# Pre-compile swagger-codegen-cli
RUN mvn -am -pl "modules/swagger-codegen-cli" package

# This exists at the end of the file to benefit from cached layers when modifying docker-entrypoint.sh.
COPY docker-entrypoint.sh /usr/local/bin/

ENTRYPOINT ["docker-entrypoint.sh"]

CMD ["help"]
@Gingonic Gingonic changed the title Dockerfile build error: module swagger-generator is missing [Docker] Dockerfile build error: module swagger-generator is missing Feb 21, 2018
@Gingonic
Copy link
Contributor Author

Could be combined with this #7678

@jimschubert
Copy link
Contributor

@Gingonic I provided the following explanation in #6870:

I've removed swagger-generator from being cached within this image. The assumption here is that anyone working on local swagger-generator modifications will likely be running that locally. Since this root Dockerfile is specifically setup to run as the locally modified CLI code, it doesn't make a lot of sense to include the ~129MB layer for swagger-generator (which doesn't get built by maven in the image). This could be revisited if it's a concern.

This was based on discussions in #6836.

Ultimately the idea was that the Dockerfile in the root was used more to generate Swagger Codedgen CLI and that most contributors would continue using run-in-docker.sh. I'd originally modified the Dockerfile to consider it a development image (see 4367311).

I don't know that it could be merged with #7678, though, because that seems related to the run-in-docker.sh script which maps the container's .m2 repository to the host's .m2 repository and a few other things that are likely the cause of the issue reported in #7678.

Would you be open to creating a PR to add the generator project back to the root Dockerfile?

@Gingonic
Copy link
Contributor Author

Gingonic commented Feb 22, 2018

@jimschubert

Would you be open to creating a PR to add the generator project back to the root Dockerfile?

Sure, I'll open a PR

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

No branches or pull requests

2 participants