Docker Compose: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(65 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Dockerfile==
{|
<source lang="bash">
|valign="top"|
FROM openjdk:8-jdk-alpine
<syntaxhighlight lang="bash" highlight="3" line>
MAINTAINER Chorke, Inc.<[email protected]>
npm install yarn@latest -g
yarn global add serve
serve -s target
</syntaxhighlight>
<syntaxhighlight lang="bash">
:'
┌──────────────────────────────────────────────────┐
│                                                  │
│  Serving!                                      │
│                                                  │
│  - Local:            http://localhost:5000      │
│  - On Your Network:  http://10.20.13.10:5000    │
│                                                  │
│  Copied local address to clipboard!            │
│                                                  │
└──────────────────────────────────────────────────┘
'
</syntaxhighlight>
 
|valign="top"|
<syntaxhighlight lang="bash">
sudo apt install build-essential libssl-dev libffi-dev\
libgmp3-dev libpq-dev python-is-python3\
python3-dev python3-pip python3-venv
</syntaxhighlight>
<syntaxhighlight lang="bash">
ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p'
nohup python3 -m http.server 5000 2> /dev/null >&1 &
:'
[1] 226938
 
 
 
 


ENV CHORKE_HOME /var/chorke
ENV SPRING_PROFILES_ACTIVE docker


ENV CHORKE_DS_POOLNAME java:jboss/datasources/H2_http_spider_devDS
'
ENV CHORKE_DS_JDBC_URL jdbc:h2:file:\${user.home}/.chorke/academia/var/h2/\${academia.datasource.database};\
kill -9 $(lsof -t -i:5000)
db_close_on_exit=false;mode=MySQL;user=\${academia.datasource.username};password=\${academia.datasource.password}
</syntaxhighlight>
ENV CHORKE_DS_DBDRIVER org.h2.Driver
ENV CHORKE_DS_DATABASE academia
ENV CHORKE_DS_USERNAME academia
ENV CHORKE_DS_PASSWORD academia
ENV CHORKE_DS_SQLQUERY SELECT 1


ENV CHORKE_H2_WEBADMIN false
|}
ENV CHORKE_H2_ALLOWALL false


ENV CHORKE_JPA_DIALECT org.hibernate.dialect.H2Dialect
==Dockerfile==
ENV CHORKE_JPA_SHOWSQL false
<syntaxhighlight lang="bash" highlight="28-32" line>
FROM openjdk:8-jdk-alpine
ENV CHORKE_HOME='/var/chorke'\
SPRING_PROFILES_ACTIVE=docker\
CHORKE_DS_POOLNAME='java:jboss/datasources/H2_http_spider_devDS'\
CHORKE_DS_JDBC_URL='jdbc:h2:file:${user.home}/.chorke/academia/var/h2/${academia.datasource.database};\
db_close_on_exit=false;mode=MySQL;user=${academia.datasource.username};password=${academia.datasource.password}'\
CHORKE_DS_DBDRIVER='org.h2.Driver'\
CHORKE_DS_DATABASE='academia'\
CHORKE_DS_USERNAME='academia'\
CHORKE_DS_PASSWORD='academia'\
CHORKE_DS_SQLQUERY='SELECT 1'\
CHORKE_H2_WEBADMIN='false'\
CHORKE_H2_ALLOWALL='false'\
CHORKE_JPA_DIALECT='org.hibernate.dialect.H2Dialect'\
CHORKE_JPA_SHOWSQL='false'\
CHORKE_GQL_ENABLED='true'\
CHORKE_GQL_BROWSER='true'\
CHORKE_LIQ_ENABLED='true'\
CHORKE_LIQ_CONTEXT='dev'\
CHORKE_LOG_ROLLING='WARN'\
CHORKE_LOG_CONSOLE='OFF'\
CHORKE_REQ_CONTEXT='/crawler'


ENV CHORKE_GQL_ENABLED true
# COPY ./*.jar  $CHORKE_HOME/chorke.jar
ENV CHORKE_GQL_BROWSER true
# RUN chmod 644 -R $CHORKE_HOME &&\
ENV CHORKE_LIQ_CONTEXT dev
#  chmod 755 $CHORKE_HOME/chorke.jar


ENV CHORKE_LOG_ROLLING WARN
RUN mkdir $CHORKE_HOME &&\
ENV CHORKE_LOG_CONSOLE OFF
chmod 644 -R $CHORKE_HOME &&\
apk add --no-cache curl &&\
curl -s http://10.20.13.10:5000/chorke.jar -o $CHORKE_HOME/chorke.jar &&\
chmod 755 $CHORKE_HOME/chorke.jar


RUN mkdir -p $CHORKE_HOME
VOLUME ["$HOME/.chorke/academia"]
WORKDIR $CHORKE_HOME
WORKDIR $CHORKE_HOME
COPY ./*.jar $CHORKE_HOME/chorke.jar
RUN chmod 755 $CHORKE_HOME/chorke.jar
RUN chmod 644 -R $CHORKE_HOME
VOLUME $HOME/.chorke/academia
EXPOSE 1983
EXPOSE 1983


ENTRYPOINT ["java", "-jar", "chorke.jar"]
ENTRYPOINT ["java", "-jar", "chorke.jar"]
</source>
</syntaxhighlight>
 
Keep in mind '''COPY''' and '''RUN''' command create same size of images layer twice. For this case if '''COPY''' created '''118MB''' layer then '''RUN''' command will be created another same size of layer. It's means another '''118MB''' layer will be added in your image. We should avoid '''COPY''' command rather we should use '''CURL''' inside '''RUN''' command to copy jar file from maven repository. That will reduce another 118MB from your image.
 
'''Example:'''
present image size => 105MB ['''FROM'''] + 118MB ['''COPY'''] + 118MB ['''RUN'''] => '''340MB'''
reduced image size => 105MB ['''FROM'''] +  0MB ['''COPY'''] + 119MB ['''RUN'''] => '''224MB'''


==docker-compose.yml==
==docker-compose.yml==
<source lang="properties">
<syntaxhighlight lang="properties">
version: "3.9"
version: "3.9"
services:
services:
   web:
   app:
     build: .
     build:
     container_name: crawler
      context: .
      dockerfile: Dockerfile
     container_name: crawler_app
    image: chorke/crawler:1.0.00
    extra_hosts:
      - "host.docker.internal:host-gateway"
    networks:
      default:
        aliases:
          - app.academia.chorke.org
    ports:
      - "127.0.0.1:1983:1983"
     labels:
     labels:
       org.chorke.academia.http.spider: "Academia Web Crawler"
       org.chorke.academia.http.spider: "Academia Web Crawler"
     depends_on:
     depends_on:
      - redis
       - db
       - db
      - redis
     environment:
     environment:
      - SPRING_PROFILES_ACTIVE=docker
       - CHORKE_DS_POOLNAME=java:jboss/datasources/PG_http_spider_devDS
       - CHORKE_DS_POOLNAME=java:jboss/datasources/PG_http_spider_devDS
       - CHORKE_DS_JDBC_URL=jdbc:postgresql://db:5432/academia
       - CHORKE_DS_JDBC_URL=jdbc:postgresql://db:5432/academia
Line 64: Line 125:
       - CHORKE_H2_WEBADMIN=false
       - CHORKE_H2_WEBADMIN=false
       - CHORKE_H2_ALLOWALL=false
       - CHORKE_H2_ALLOWALL=false
      - CHORKE_JPA_DIALECT=org.hibernate.dialect.PostgreSQLDialect
      - CHORKE_JPA_SHOWSQL=false
      - CHORKE_GQL_ENABLED=true
       - CHORKE_GQL_BROWSER=true
       - CHORKE_GQL_BROWSER=true
       - CHORKE_GQL_ENABLED=true
       - CHORKE_LIQ_ENABLED=true
      - CHORKE_JPA_DIALECT=org.hibernate.dialect.PostgreSQLDialect
      - CHORKE_JPA_SHOWSQL=true
       - CHORKE_LIQ_CONTEXT=dev
       - CHORKE_LIQ_CONTEXT=dev
      - CHORKE_LOG_ROLLING=WARN
      - CHORKE_LOG_CONSOLE=OFF
      - CHORKE_REQ_CONTEXT=/crawler
   redis:
   redis:
     container_name: redis
     container_name: crawler_redis
     image: redis
     image: 'redis:6.0.10-alpine'
      networks:
    networks:
        default:
      default:
          aliases:
        aliases:
            - redis.academia.chorke.org
          - redis.academia.chorke.org
   db:
   db:
     image: 'postgres:13.1-alpine'
     image: 'postgres:13.1-alpine'
       networks:
    container_name: crawler_psql
        default:
    environment:
          aliases:
      - POSTGRES_PASSWORD=academia
            - db.academia.chorke.org
      - POSTGRES_USER=academia
       - POSTGRES_DB=academia
    networks:
      default:
        aliases:
          - db.academia.chorke.org
networks:
networks:
   default:
   default:
Line 87: Line 157:
       config:
       config:
         - subnet: 10.20.21.0/24
         - subnet: 10.20.21.0/24
</source>
</syntaxhighlight>


==application-docker.yml==
==application-docker.yml==
<source lang="properties">
<syntaxhighlight lang="properties" line>
################################################################################
################################################################################
# application snake yaml properties
# application snake yaml properties
################################################################################
################################################################################
academia:
academia:
  env:
    user:
      home: ${user.home}
      mode: dev
      name: ${user.name}
      temp: ${java.io.tmpdir}
   datasource:
   datasource:
     url: ${CHORKE_DS_JDBC_URL}
     url: ${CHORKE_DS_JDBC_URL}
Line 108: Line 172:
     poolname: ${CHORKE_DS_POOLNAME}
     poolname: ${CHORKE_DS_POOLNAME}
server:
server:
   tomcat:
   servlet:
     basedir: ./target/
     contextPath: ${CHORKE_REQ_CONTEXT}
spring:
spring:
  thymeleaf:
    mode: HTML
    prefix: classpath:/META-INF/thymeleaf/
   datasource:
   datasource:
    type: com.zaxxer.hikari.HikariDataSource
    url: ${academia.datasource.url}
    username: ${academia.datasource.username}
    password: ${academia.datasource.password}
     driver-class-name: ${CHORKE_DS_DBDRIVER}
     driver-class-name: ${CHORKE_DS_DBDRIVER}
     hikari:
     hikari:
      pool-name: ${academia.datasource.poolname}
       connection-test-query: ${CHORKE_DS_SQLQUERY}
       connection-test-query: ${CHORKE_DS_SQLQUERY}
      auto-commit: false
logging:
  level:
    org.springframework: WARN
    org.chorke: INFO
---
spring:
  profiles: dev
logging:
  level:
    org.springframework: WARN
    org.chorke: INFO
---
spring:
  profiles: uat
logging:
  level:
    org.springframework: WARN
    org.chorke: WARN
---
spring:
  profiles: pro
logging:
  level:
    org.springframework: WARN
    org.chorke: WARN
################################################################################
################################################################################
# built on: Sat, Oct 10 2020, 10:10 +0000                    by: [email protected]
# built on: Sat, Oct 10 2020, 10:10 +0000                    by: [email protected]
################################################################################
################################################################################
</source>
</syntaxhighlight>


==application-docker.properties==
==application-docker.properties==
<source lang="properties">
<syntaxhighlight lang="properties" line>
################################################################################
################################################################################
# application properties
# application properties
################################################################################
################################################################################
spring.jackson.date-format: yyyy-MM-dd'T'HH:mm:ss
spring.servlet.multipart.max-request-size: 10MB
spring.servlet.multipart.max-file-size: 1MB
spring.main.banner-mode: off
spring.profiles.active: dev
server.ssl.key-store: ${user.home}/.chorke/academia/etc/keystore/http/dev/spider.jks
server.ssl.key-store-password: storepasswd
server.ssl.key-password: storepasswd
server.ssl.keyAlias: academia
server.ssl.enabled: false
academia.http.spider.seleniumDriverBasePath: ${user.home}/.chorke/academia/var/selenium/driver
academia.http.spider.seleniumDriverTempPath: ${user.home}/.chorke/academia/tmp/selenium/driver
academia.http.spider.crawlUserAgentString: Finology Crawler (https://academia.com.my/)
academia.http.spider.crawlStorageFolder: ${user.home}/.chorke/academia/tmp/http/spider
academia.http.spider.maxDepthOfCrawling: 2
academia.http.spider.resumableCrawling: false
academia.http.spider.numberOfCrawlers: 7
academia.http.spider.politenessDelay: 200
academia.http.spider.maxPagesToFetch: -1
academia.http.spider.enabledRobots: false
academia.http.spider.enabledChrome: false
spring.jpa.properties.hibernate.dialect: ${CHORKE_JPA_DIALECT}
spring.jpa.properties.hibernate.dialect: ${CHORKE_JPA_DIALECT}
spring.jpa.properties.hibernate.format_sql: true
spring.jpa.properties.hibernate.format_sql: true
spring.jpa.hibernate.ddl-auto: none
spring.jpa.open-in-view: false
spring.jpa.show-sql: ${CHORKE_JPA_SHOWSQL}
spring.jpa.show-sql: ${CHORKE_JPA_SHOWSQL}
spring.cache.ehcache.config: classpath:/META-INF/ehcache/ehcache.xml
spring.cache.cache-names: academia_cache
spring.cache.type: ehcache


spring.h2.console.settings.web-allow-others: ${CHORKE_H2_ALLOWALL}
spring.h2.console.settings.web-allow-others: ${CHORKE_H2_ALLOWALL}
spring.h2.console.settings.trace: false
spring.h2.console.path: /h2admin
spring.h2.console.enabled: ${CHORKE_H2_WEBADMIN}
spring.h2.console.enabled: ${CHORKE_H2_WEBADMIN}


graphql.servlet.mapping: /graphql
graphql.servlet.enabled: ${CHORKE_GQL_ENABLED}
graphql.servlet.enabled: ${CHORKE_GQL_ENABLED}
graphiql.mapping: /graphiql
graphiql.endpoint: /graphql
graphiql.enabled: ${CHORKE_GQL_BROWSER}
graphiql.enabled: ${CHORKE_GQL_BROWSER}


spring.liquibase.enabled: true
spring.liquibase.enabled: ${CHORKE_LIQ_ENABLED}
spring.liquibase.contexts: ${CHORKE_LIQ_CONTEXT}
spring.liquibase.contexts: ${CHORKE_LIQ_CONTEXT}
spring.liquibase.change-log: classpath:/META-INF/migrations/db.changelog-master.xml
################################################################################
################################################################################
# built on: Sat, Oct 10 2020, 10:10 +0000                    by: [email protected]
# built on: Sat, Oct 10 2020, 10:10 +0000                    by: [email protected]
################################################################################
################################################################################
</source>
</syntaxhighlight>
 
==log4j2.xml==
<syntaxhighlight lang="xml" highlight="7,8,24" line>
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Properties>
        <Property name="academia.log.format">%d{MMM dd, yyyy HH:mm:ss a} %c [METHOD: %M , LINE: %L]%n[%-5p][%t] %m%n</Property>
        <Property name="academia.log.file.gz">${academia.log.dir}/%d{yyyyMM}/SPIDER-%d{yyyyMMdd}-%i.log.gz</Property>
        <Property name="academia.log.dir">${sys:user.home}/.chorke/academia/var/log/http</Property>
        <Property name="academia.log.rolling">${env:CHORKE_LOG_ROLLING:-INFO}</Property>
        <Property name="academia.log.console">${env:CHORKE_LOG_CONSOLE:-INFO}</Property>
        <Property name="academia.log.file">${academia.log.dir}/SPIDER.log</Property>
    </Properties>
    <Appenders>
        <RollingFile name="rolling" fileName="${academia.log.file}" filePattern="${academia.log.file.gz}" ignoreExceptions="false">
            <PatternLayout pattern="${academia.log.format}"/>
            <Policies>
                <SizeBasedTriggeringPolicy size="10 MB"/>
                <TimeBasedTriggeringPolicy interval="1"/>
                <OnStartupTriggeringPolicy />
            </Policies>
            <DefaultRolloverStrategy max="20"/>
        </RollingFile>
        <Console name="console" target="SYSTEM_OUT">
          <PatternLayout pattern="${academia.log.format}"/>
        </Console>
        <Async name="async" includeLocation="true">
            <AppenderRef ref="console" level="${academia.log.console}"/>
            <AppenderRef ref="rolling" level="${academia.log.rolling}"/>
        </Async>
    </Appenders>
    <Loggers>
        <Logger name="org.chorke.academia.http.spider.mapper" level="WARN"/>
        <Logger name="springfox.documentation" level="WARN"/>
        <Logger name="edu.uci.ics.crawler4j" level="ERROR"/>
        <Logger name="org.apache.activemq" level="WARN"/>
        <Logger name="org.chorke.academia" level="INFO"/>
        <Logger name="org.springframework" level="WARN"/>
        <Logger name="org.apache.camel" level="WARN"/>
        <Logger name="org.thymeleaf" level="WARN"/>
        <Logger name="javax.servlet" level="WARN"/>
        <Logger name="bitronix.tm" level="WARN"/>
        <Logger name="org.jasypt" level="WARN"/>
        <Logger name="org.quartz" level="WARN"/>
        <Logger name="com.zaxxer" level="WARN"/>
        <Root level="INFO">
            <AppenderRef ref="async"/>
        </Root>
    </Loggers>
</Configuration>
</syntaxhighlight>
 
==Knowledge==
docker \
run --detach \
--name crawler \
--publish 1983:1983  \
chorke/crawler:1.0.00
docker compose up
docker compose up -d
docker compose logs -f -t
docker logs crawler
docker logs -f crawler
docker exec -it crawler /bin/sh
docker inspect crawler_app|grep compose
docker build --rm -t 'chorke/crawler:1.0.00' -f ./Dockerfile .
docker run --name='crawler' -d -p 1983:1983 chorke/crawler:1.0.00
docker run --rm --name='crawler' -d -p 1983:1983 chorke/crawler:1.0.00
docker run --rm --name='crawler' -d -p 1983:1983 hub.chorke.org/chorke/crawler:1.0.00
 
'''docker push and pull'''
docker login reg.chorke.org -u academia -p sadaqah!
docker tag chorke/crawler:1.0.00 reg.chorke.org/chorke/crawler:1.0.00
docker push reg.chorke.org/chorke/crawler:1.0.00
docker login hub.chorke.org -u academia -p sadaqah!
docker pull  hub.chorke.org/chorke/crawler:1.0.00
docker tag  hub.chorke.org/chorke/crawler:1.0.00 chorke/crawler:1.0.00
docker rmi  hub.chorke.org/chorke/crawler:1.0.00
 
docker logout hub.chorke.org
docker logout reg.chorke.org
 
docker \
run --detach \
--name crawler \
--publish 1983:1983  \
hub.chorke.org/chorke/crawler:1.0.00
docker exec -it crawler /bin/sh
 
'''nodejs static web server for curl'''
npm install yarn@latest -g
yarn global add serve
serve -s target
 
<syntaxhighlight lang="bash">
if [[ "$(</proc/sys/kernel/osrelease)" == *microsoft* ]];then echo 'WSL enabled';fi
if grep -qEi '(Microsoft|WSL)' /proc/version &>/dev/null;then echo 'WSL enabled';fi
if [[ "$(</proc/version)" == *microsoft* ]];then echo 'WSL enabled';fi
</syntaxhighlight>


==References==
==References==
Line 240: Line 336:


| valign="top" |
| valign="top" |
* [https://stackoverflow.com/questions/49718431/ <code>docker-compose.yml</code> file naming convention]
* [https://docs.docker.com/compose/compose-file/compose-file-v3/#aliases Docker Compose Service Host Name Alias]
* [https://docs.docker.com/compose/compose-file/compose-file-v3/#aliases Docker Compose Service Host Name Alias]
* [https://www.sandtable.com/reduce-docker-image-sizes-using-alpine/ Reduce Docker image sizes using Alpine]
* [https://docs.docker.com/compose/environment-variables/ Docker Compose Environment Variables]
* [[Build LDAP Docker Image from Ubuntu]]
* [https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ Best practices for writing Dockerfiles]
* [https://docs.docker.com/compose/compose-file/compose-file-v3/#ipv4_address-ipv6_address Docker Compose Specify a static IP]
* [https://docs.docker.com/compose/compose-file/compose-file-v3/#ipv4_address-ipv6_address Docker Compose Specify a static IP]
* [https://stackoverflow.com/questions/8058793/ Single Line Python Webserver]
* [https://stackoverflow.com/questions/31222377/ Reduce Docker Image Size]
* [https://stackoverflow.com/questions/37195222/ Docker Compose View Log]
|-
| colspan="3" |
----
|-
| valign="top" |
* [https://adhoctuts.com/run-mulitple-databases-in-single-machine-using-docker-vagrant/ Run MySQL, Oracle, MSSQL, PostgreSQL & MongoDB]
* [https://devopscube.com/reduce-docker-image-size/ Reduce Docker Image Size: 6 Optimal Methods]
* [https://github.com/MariaDB/mariadb-docker/issues/15 Support MariaDB Multiple databases in Docker]
* [https://www.baeldung.com/linux/docker-multiple-databases Use Multiple Databases with Docker Compose]
* [https://medium.com/@TimvanBaarsen/how-to-connect-to-the-docker-host-from-inside-a-docker-container-112b4c71bc66  Connect to the Docker host from a Container]
* [https://stackoverflow.com/questions/50173296/ MariaDB Multiple databases in Docker]
* [https://kitloong.medium.com/how-to-run-sql-server-2019-on-macbook-pro-m1-d1448525f805 SQL Server 2019 on MacBook Pro M1]
* [https://github.com/oracle/docker-images Docker Images from Oracle]
* [https://docs.docker.com/develop/develop-images/multistage-build/ Docker Multi-Stage builds]
* [[Java Remote Debug]]
| valign="top" |
* [https://medium.com/@TimvanBaarsen/how-to-connect-to-the-docker-host-from-inside-a-docker-container-112b4c71bc66  Docker » Host » <code>host.docker.internal</code>]
* [https://stackoverflow.com/questions/35689628/ Docker » Alpine Shell Access]
* [https://stackoverflow.com/questions/43099408/ Docker » Stack vs. Compose]
* [[Docker/Compose/GitLab|Docker » Compose » GitLab]]
* [https://docs.docker.com/engine/reference/commandline/checkpoint/ Docker » Checkpoint]
* [[Dockerized PostgreSQL|Docker » PostgreSQL]]
* [https://docs.docker.com/engine/reference/commandline/commit/ Docker » Commit]
| valign="top" |


|}
|}

Latest revision as of 22:42, 25 September 2024

npm install yarn@latest -g
yarn global add serve
serve -s target
:'
 ┌──────────────────────────────────────────────────┐
 │                                                  │
 │   Serving!                                       │
 │                                                  │
 │   - Local:            http://localhost:5000      │
 │   - On Your Network:  http://10.20.13.10:5000    │
 │                                                  │
 │   Copied local address to clipboard!             │
 │                                                  │
 └──────────────────────────────────────────────────┘
'
sudo apt install build-essential libssl-dev libffi-dev\
 libgmp3-dev libpq-dev python-is-python3\
 python3-dev python3-pip python3-venv
ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p'
nohup python3 -m http.server 5000 2> /dev/null >&1 &
:'
[1] 226938






'
kill -9 $(lsof -t -i:5000)

Dockerfile

FROM openjdk:8-jdk-alpine
ENV CHORKE_HOME='/var/chorke'\
 SPRING_PROFILES_ACTIVE=docker\
 CHORKE_DS_POOLNAME='java:jboss/datasources/H2_http_spider_devDS'\
 CHORKE_DS_JDBC_URL='jdbc:h2:file:${user.home}/.chorke/academia/var/h2/${academia.datasource.database};\
db_close_on_exit=false;mode=MySQL;user=${academia.datasource.username};password=${academia.datasource.password}'\
 CHORKE_DS_DBDRIVER='org.h2.Driver'\
 CHORKE_DS_DATABASE='academia'\
 CHORKE_DS_USERNAME='academia'\
 CHORKE_DS_PASSWORD='academia'\
 CHORKE_DS_SQLQUERY='SELECT 1'\
 CHORKE_H2_WEBADMIN='false'\
 CHORKE_H2_ALLOWALL='false'\
 CHORKE_JPA_DIALECT='org.hibernate.dialect.H2Dialect'\
 CHORKE_JPA_SHOWSQL='false'\
 CHORKE_GQL_ENABLED='true'\
 CHORKE_GQL_BROWSER='true'\
 CHORKE_LIQ_ENABLED='true'\
 CHORKE_LIQ_CONTEXT='dev'\
 CHORKE_LOG_ROLLING='WARN'\
 CHORKE_LOG_CONSOLE='OFF'\
 CHORKE_REQ_CONTEXT='/crawler'

# COPY ./*.jar  $CHORKE_HOME/chorke.jar
# RUN chmod 644 -R $CHORKE_HOME &&\
#  chmod 755 $CHORKE_HOME/chorke.jar

RUN mkdir $CHORKE_HOME &&\
 chmod 644 -R $CHORKE_HOME &&\
 apk add --no-cache curl &&\
 curl -s http://10.20.13.10:5000/chorke.jar -o $CHORKE_HOME/chorke.jar &&\
 chmod 755 $CHORKE_HOME/chorke.jar

VOLUME ["$HOME/.chorke/academia"]
WORKDIR $CHORKE_HOME
EXPOSE 1983

ENTRYPOINT ["java", "-jar", "chorke.jar"]
Keep in mind COPY and RUN command create same size of images layer twice. For this case if COPY created 118MB layer then RUN command will be created another same size of layer. It's means another 118MB layer will be added in your image. We should avoid COPY command rather we should use CURL inside RUN command to copy jar file from maven repository. That will reduce another 118MB from your image. 
Example:
present image size => 105MB [FROM] + 118MB [COPY] + 118MB [RUN] => 340MB 
reduced image size => 105MB [FROM] +   0MB [COPY] + 119MB [RUN] => 224MB

docker-compose.yml

version: "3.9"
services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: crawler_app
    image: chorke/crawler:1.0.00
    extra_hosts:
      - "host.docker.internal:host-gateway"
    networks:
      default:
        aliases:
          - app.academia.chorke.org
    ports:
      - "127.0.0.1:1983:1983"
    labels:
      org.chorke.academia.http.spider: "Academia Web Crawler"
    depends_on:
      - redis
      - db
    environment:
      - CHORKE_DS_POOLNAME=java:jboss/datasources/PG_http_spider_devDS
      - CHORKE_DS_JDBC_URL=jdbc:postgresql://db:5432/academia
      - CHORKE_DS_DBDRIVER=org.postgresql.Driver
      - CHORKE_DS_DATABASE=academia
      - CHORKE_DS_USERNAME=academia
      - CHORKE_DS_PASSWORD=academia
      - CHORKE_DS_SQLQUERY=SELECT 1
      - CHORKE_H2_WEBADMIN=false
      - CHORKE_H2_ALLOWALL=false
      - CHORKE_JPA_DIALECT=org.hibernate.dialect.PostgreSQLDialect
      - CHORKE_JPA_SHOWSQL=false
      - CHORKE_GQL_ENABLED=true
      - CHORKE_GQL_BROWSER=true
      - CHORKE_LIQ_ENABLED=true
      - CHORKE_LIQ_CONTEXT=dev
      - CHORKE_LOG_ROLLING=WARN
      - CHORKE_LOG_CONSOLE=OFF
      - CHORKE_REQ_CONTEXT=/crawler
  redis:
    container_name: crawler_redis
    image: 'redis:6.0.10-alpine'
    networks:
      default:
        aliases:
          - redis.academia.chorke.org
  db:
    image: 'postgres:13.1-alpine'
    container_name: crawler_psql
    environment:
      - POSTGRES_PASSWORD=academia
      - POSTGRES_USER=academia
      - POSTGRES_DB=academia
    networks:
      default:
        aliases:
          - db.academia.chorke.org
networks:
  default:
    ipam:
      config:
        - subnet: 10.20.21.0/24

application-docker.yml

################################################################################
# application snake yaml properties
################################################################################
academia:
  datasource:
    url: ${CHORKE_DS_JDBC_URL}
    database: ${CHORKE_DS_DATABASE}
    username: ${CHORKE_DS_USERNAME}
    password: ${CHORKE_DS_PASSWORD}
    poolname: ${CHORKE_DS_POOLNAME}
server:
  servlet:
    contextPath: ${CHORKE_REQ_CONTEXT}
spring:
  datasource:
    driver-class-name: ${CHORKE_DS_DBDRIVER}
    hikari:
      connection-test-query: ${CHORKE_DS_SQLQUERY}
################################################################################
# built on: Sat, Oct 10 2020, 10:10 +0000                    by: [email protected]
################################################################################

application-docker.properties

################################################################################
# application properties
################################################################################
spring.jpa.properties.hibernate.dialect: ${CHORKE_JPA_DIALECT}
spring.jpa.properties.hibernate.format_sql: true
spring.jpa.show-sql: ${CHORKE_JPA_SHOWSQL}

spring.h2.console.settings.web-allow-others: ${CHORKE_H2_ALLOWALL}
spring.h2.console.enabled: ${CHORKE_H2_WEBADMIN}

graphql.servlet.enabled: ${CHORKE_GQL_ENABLED}
graphiql.enabled: ${CHORKE_GQL_BROWSER}

spring.liquibase.enabled: ${CHORKE_LIQ_ENABLED}
spring.liquibase.contexts: ${CHORKE_LIQ_CONTEXT}
################################################################################
# built on: Sat, Oct 10 2020, 10:10 +0000                    by: [email protected]
################################################################################

log4j2.xml

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Properties>
        <Property name="academia.log.format">%d{MMM dd, yyyy HH:mm:ss a} %c [METHOD: %M , LINE: %L]%n[%-5p][%t] %m%n</Property>
        <Property name="academia.log.file.gz">${academia.log.dir}/%d{yyyyMM}/SPIDER-%d{yyyyMMdd}-%i.log.gz</Property>
        <Property name="academia.log.dir">${sys:user.home}/.chorke/academia/var/log/http</Property>
        <Property name="academia.log.rolling">${env:CHORKE_LOG_ROLLING:-INFO}</Property>
        <Property name="academia.log.console">${env:CHORKE_LOG_CONSOLE:-INFO}</Property>
        <Property name="academia.log.file">${academia.log.dir}/SPIDER.log</Property>
    </Properties>
    <Appenders>
        <RollingFile name="rolling" fileName="${academia.log.file}" filePattern="${academia.log.file.gz}" ignoreExceptions="false">
            <PatternLayout pattern="${academia.log.format}"/>
            <Policies>
                <SizeBasedTriggeringPolicy size="10 MB"/>
                <TimeBasedTriggeringPolicy interval="1"/>
                <OnStartupTriggeringPolicy />
            </Policies>
            <DefaultRolloverStrategy max="20"/>
        </RollingFile>
        <Console name="console" target="SYSTEM_OUT">
           <PatternLayout pattern="${academia.log.format}"/>
        </Console>
        <Async name="async" includeLocation="true">
            <AppenderRef ref="console" level="${academia.log.console}"/>
            <AppenderRef ref="rolling" level="${academia.log.rolling}"/>
        </Async>
    </Appenders>
    <Loggers>
        <Logger name="org.chorke.academia.http.spider.mapper" level="WARN"/>
        <Logger name="springfox.documentation" level="WARN"/>
        <Logger name="edu.uci.ics.crawler4j" level="ERROR"/>
        <Logger name="org.apache.activemq" level="WARN"/>
        <Logger name="org.chorke.academia" level="INFO"/>
        <Logger name="org.springframework" level="WARN"/>
        <Logger name="org.apache.camel" level="WARN"/>
        <Logger name="org.thymeleaf" level="WARN"/>
        <Logger name="javax.servlet" level="WARN"/>
        <Logger name="bitronix.tm" level="WARN"/>
        <Logger name="org.jasypt" level="WARN"/>
        <Logger name="org.quartz" level="WARN"/>
        <Logger name="com.zaxxer" level="WARN"/>
        <Root level="INFO">
            <AppenderRef ref="async"/>
        </Root>
    </Loggers>
</Configuration>

Knowledge

docker \
run --detach \
--name crawler \
--publish 1983:1983  \
chorke/crawler:1.0.00

docker compose up
docker compose up -d
docker compose logs -f -t

docker logs crawler
docker logs -f crawler
docker exec -it crawler /bin/sh
docker inspect crawler_app|grep compose

docker build --rm -t 'chorke/crawler:1.0.00' -f ./Dockerfile .
docker run --name='crawler' -d -p 1983:1983 chorke/crawler:1.0.00
docker run --rm --name='crawler' -d -p 1983:1983 chorke/crawler:1.0.00
docker run --rm --name='crawler' -d -p 1983:1983 hub.chorke.org/chorke/crawler:1.0.00
docker push and pull
docker login reg.chorke.org -u academia -p sadaqah!
docker tag chorke/crawler:1.0.00 reg.chorke.org/chorke/crawler:1.0.00
docker push reg.chorke.org/chorke/crawler:1.0.00

docker login hub.chorke.org -u academia -p sadaqah!
docker pull  hub.chorke.org/chorke/crawler:1.0.00
docker tag   hub.chorke.org/chorke/crawler:1.0.00 chorke/crawler:1.0.00
docker rmi   hub.chorke.org/chorke/crawler:1.0.00
docker logout hub.chorke.org
docker logout reg.chorke.org
docker \
run --detach \
--name crawler \
--publish 1983:1983  \
hub.chorke.org/chorke/crawler:1.0.00
docker exec -it crawler /bin/sh
nodejs static web server for curl
npm install yarn@latest -g
yarn global add serve
serve -s target
if [[ "$(</proc/sys/kernel/osrelease)" == *microsoft* ]];then echo 'WSL enabled';fi
if grep -qEi '(Microsoft|WSL)' /proc/version &>/dev/null;then echo 'WSL enabled';fi
if [[ "$(</proc/version)" == *microsoft* ]];then echo 'WSL enabled';fi

References