Ions push and deploy slow in Docker container

Hi,
Does anyone have any experience pushing and deploying ions from a container? Any input is appreciated.

The application being deployed is component based following the Polylith pattern.

For some reason, pushing/deploying takes a lot longer (10 min +) compared to doing it “natively” from WSL on my Windows machine (seconds). The project directory is mounted in the container and the ions commands are executed in the running container.

For example, executing this command in the container:

 clojure -M:ion-dev '{:op :push :creds-profile my-creds :region my-region :uname my-unrep-name}'

Here is my Dockerfile:

FROM clojure

RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install curl unzip vim -y

# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.2.39.zip" -o "awscliv2.zip"
RUN unzip awscliv2.zip
RUN ./aws/install

# Install Maven
RUN curl "https://dlcdn.apache.org/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.zip" -o "maven.zip"
RUN unzip maven.zip
ENV PATH "$PATH:/tmp/apache-maven-3.8.3/bin"

# Install Polylith tool
RUN curl -L https://github.com/polyfy/polylith/releases/download/v0.1.0-alpha9/poly-0.1.0-alpha9.jar -o poly-0.1.0-alpha9.jar
RUN mkdir /usr/local/polylith
RUN mv poly-0.1.0-alpha9.jar /usr/local/polylith
COPY tooling/poly /usr/local/bin/poly
RUN sed -i 's/\r//' /usr/local/bin/poly

# Install Cognitect dev-tools
COPY ./tooling/settings.xml /root/.m2

COPY ./tooling/cognitect* ./cognitect
RUN cognitect*/install

# Copy the user deps.edn for using the ion-dev tools
COPY  ./tooling/deps.edn /root/.clojure/

# Create directory in which the repository will be mounted and all commands are executed
WORKDIR /root/tmp/app

Here is the .clojure/deps.edn used in the container:

{
   :deps {
     org.clojure/clojure {:mvn/version "1.10.3"}
     com.datomic/ion {:mvn/version "0.9.50"}
   }
   :aliases {
     :ion-dev
       {
         :deps {com.datomic/ion-dev {:mvn/version "0.9.290"}}
         :main-opts ["-m" "datomic.ion.dev"]
       }
   }
  :mvn/repos {
    "cognitect-dev-tools" {:url "https://dev-tools.cognitect.com/maven/releases/"}
    "datomic-cloud" {:url "s3://datomic-releases-1fc2183a/maven/releases"}
  }
}

And here is the projects deps.edn:

{:paths     [; Base
             "../../bases/ions/resources"
             "../../bases/ions/src"

             ; Components
             "../../components/log/src"
             "../../components/media/src"
             "../../components/mount/src"
             ...
             ]

 :deps      {clj-http/clj-http              {:mvn/version "3.10.0"}
             clj-oauth/clj-oauth            {:mvn/version "1.5.5"}
             clj-time/clj-time              {:mvn/version "0.15.2"}
             commons-codec/commons-codec    {:mvn/version "1.13"}
             com.amazonaws/aws-java-sdk-kms {:mvn/version "1.11.826"}
             com.amazonaws/aws-java-sdk-s3  {:mvn/version "1.11.826"}
             com.cognitect.aws/api          {:mvn/version "0.8.352"}
             com.cognitect.aws/cognito-idp  {:mvn/version "746.2.533.0"}
             com.cognitect.aws/endpoints    {:mvn/version "1.1.11.607"}
             com.cognitect.aws/lambda       {:mvn/version "718.2.454.0"}
             com.cognitect.aws/logs         {:mvn/version "738.2.501.0"}
             com.cognitect.aws/s3           {:mvn/version "726.2.488.0"}
             com.cognitect.aws/ssm          {:mvn/version "737.2.498.0"}
             com.cognitect.aws/states       {:mvn/version "707.2.409.0"}
             com.cognitect/s3-creds         {:mvn/version "0.1.23"}
             com.datomic/client-cloud       {:mvn/version "0.8.102"}
             com.datomic/ion                {:mvn/version "0.9.48"}
             compact-uuids/compact-uuids    {:mvn/version "0.2.0"}
             metosin/jsonista               {:mvn/version "0.2.4"}
             metosin/reitit-core            {:mvn/version "0.3.9"}
             metosin/reitit-middleware      {:mvn/version "0.3.9"}
             metosin/reitit-ring            {:mvn/version "0.3.9"}
             metosin/reitit-spec            {:mvn/version "0.3.9"}
             metosin/spec-tools             {:mvn/version "0.10.0"}
             org.clojure/clojure            {:mvn/version "1.10.1"}
             org.clojure/core.cache         {:mvn/version "1.0.207"}
             org.clojure/data.codec         {:mvn/version "0.1.1"}
             org.clojure/data.priority-map  {:mvn/version "1.0.0"}
             org.clojure/test.check         {:mvn/version "0.10.0"}
             org.jcodec/jcodec              {:mvn/version "0.2.3"}
             org.jcodec/jcodec-javase       {:mvn/version "0.2.3"}}

 :mvn/repos {"datomic-cloud"       {:url "s3://datomic-releases-1fc2183a/maven/releases"}
             "cognitect-dev-tools" {:url "https://dev-tools.cognitect.com/maven/releases/"}}

 :aliases   {:ion-dev {:extra-deps {com.datomic/ion-dev {:mvn/version "0.9.276"}}
                       :main-opts  ["-m" "datomic.ion.dev"]}

             :test    {:extra-paths [; Bases
                                     "../../bases/ions/test"

                                     ; Components
                                     "../../components/ad-core/test"
                                     "../../components/company/test"
                                     "../../components/utils/resources"
                                     "../../components/utils/src"]

                       :extra-deps  {com.datomic/dev-local {:mvn/version "0.9.225"}
                                     mockery/mockery       {:mvn/version "0.1.4"}}}}}

Seems like this is a fairly common issue with mounted volumes in Docker. Copying the directory instead of mounting it solves the issue.

1 Like