swagger-api / swagger-api/swagger-codegen

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

Open
#7,706 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

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"]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the repository Dockerfile and reproduce the issue using docker build . from the repository root. Check how the listed modules are copied and how Maven builds the CLI, then verify that a standalone Docker build no longer reports the missing swagger-generator module.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
build-system, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.