Skip to content

Commit

Permalink
Reduce size of cli docker image by removing tar
Browse files Browse the repository at this point in the history
fixes: #213

Have the Gradle build unpack the distribution tar archive. This means there is no need to install tar or to have the tar file in the Docker image.
  • Loading branch information
big-andy-coates committed Oct 4, 2023
1 parent 5d21aef commit eb02576
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
7 changes: 0 additions & 7 deletions cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,16 @@ ENV VERSION=$APP_VERSION

LABEL org.opencontainers.image.source=https://github.com/specmesh/specmesh-build/tree/main/cli

RUN yum update -y
RUN yum install -y tar lsof

RUN mkdir -p /opt/specmesh

COPY bin /bin
COPY log4j /log

RUN chmod +x /bin/*.sh

COPY ${APP_NAME}-${APP_VERSION}.tar /opt/specmesh
WORKDIR /opt/specmesh

RUN tar xf ${APP_NAME}-${APP_VERSION}.tar
RUN ln -s ${APP_NAME}-${APP_VERSION} service



ENTRYPOINT ["/bin/wrapper.sh"]
#No CMD instruction is provided, allowing you to pass any number of arguments at runtime.
2 changes: 1 addition & 1 deletion cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ tasks.register<Copy>("prepareDocker") {

from(
layout.projectDirectory.file("Dockerfile"),
layout.buildDirectory.file("distributions/${project.name}-${project.version}.tar"),
tarTree(layout.buildDirectory.file("distributions/${project.name}-${project.version}.tar")),
layout.projectDirectory.dir("include"),
)

Expand Down

0 comments on commit eb02576

Please sign in to comment.