Sign inSign up

megaease/easeimg-javabuild

By megaease

•Updated almost 3 years ago

Image
0

3.3K

megaease/easeimg-javabuild repository overview

⁠megaease-easeimg-javabuild

The Codebase for build base image which dedicated to buiding java application image

  1. How to use megaease-easeimg-javabuild image

    In the application Dockerfile

FROM megaease/easeimg-javabuild AS builder 
ARG      REPOSITORY1
ARG      REPOSITORY2
ARG      REPOSITORY3
ARG      MIRROR1
ARG      MIRROR2
ARG      MIRROR3
ARG      SERVER1
ARG      SERVER2
ARG      SERVER3
COPY     pom.xml /easepay-check/pom.xml
WORKDIR  /easepay-check
RUN 	 rewrite-settings.sh && \ 
         cd /easepay-check/ && mvn dependency:go-offline -B
COPY     src /easepay-check/src
COPY     resources /easepay-check/resources
RUN      mkdir out \
            && /easepay-check/resources/scripts/build-app.sh
...

Notice:

  • must declare ARG variable, variable name equals --build-arg <name>

  • before mvn command, call rewrite-settings.sh to reset maven setting.

    When execute docker build to create image.send build-arg to setup maven repository url.

    Args:

    • SERVER1,SERVER2,SERVER3
      • generate content: <server><id>xxx</id><username>xxx</username><password>xxx</password>
      • syntax: id|user|passwd
      • example: SERVER1='km-nexus|admin|pass'
    • REPOSITORY1,REPOSITORY2,REPOSITORY3
      • generate content: <repository><id>xxx</id><url>xxx</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository>
      • syntax: id|url|release-enable|snapshot-enable
      • example: REPOSITORY1='km-nexus|http://km.xxx.com/nexus/repository|true|false'
    • MIRROR1,MIRROR2,MIRROR3
      • generate content: <mirror><id>xxx</id><url>xxx</url><mirrorOf>xxx</mirrorOf></mirror>
      • syntax: id|url|mirrorof
      • example: MIRROR1='aliyun-nexus|http://maven.aliyun.com/nexus/content/groups/public/|*,!local-repo'

    If all args is not set, maven use default settings repository. else use args set url setting repository.

    Cmd:

    export SERVER1='km-nexus|admin|pass'
    export SERVER2='sh-nexus|admin1|pass1'
    export REPOSITORY1='km-nexus|http://km.xxx.com/nexus/repository|true|false'
    export MIRROR1='aliyun-nexus|http://maven.aliyun.com/nexus/content/groups/public/|*,!local-repo'
    docker build --build-arg SERVER1 --build-arg SERVER2 --build-arg REPOSITORY1 --build-arg MIRROR1 -t appimg -f Dockerfile .
    
    ⁠Accessory

    Settings template:

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0  https://maven.apache.org/xsd/settings-1.0.0.xsd">
      <profiles>
        <profile>
          <id>autoci</id>
          <repositories>
            <repository>
              <id>xxxx</id>
              <url>xxxx</url>
              <releases><enabled>true</enabled></releases>
              <snapshots><enabled>false</enabled></snapshots>
            </repository>
          </repositories>
      </profile>
    </profiles>
    <activeProfiles>
      <activeProfile>autoci</activeProfile>
    </activeProfiles>
    
    <mirrors>
      <mirror>
          <id>xxx</id>
          <url>xxx</url>
          <mirrorOf>xxx</mirrorOf>
      </mirror>
    </mirrors>
    
    <servers>
      <server>
        <id>xxx</id>
        <username>xxx</username>
        <password>xxx</password>
      </server>
    </servers>
    
```

Tag summary

Content type

Image

Digest

sha256:9e34f813b…

Size

98.9 MB

Last updated

almost 3 years ago

docker pull megaease/easeimg-javabuild