Skip to content

Commit

Permalink
reduce docker images size
Browse files Browse the repository at this point in the history
  • Loading branch information
tenmoves committed May 2, 2023
1 parent 0d011cd commit dcad60b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ RUN apk add --no-cache --update \
g++ \
git \
npm \
python3 \
wget \
openssl \
libsodium-dev \
Expand Down Expand Up @@ -82,5 +81,8 @@ COPY --from=build /opt/code/.git /opt/code/.git
WORKDIR /opt/code
RUN git reset --hard

RUN rm -rf /opt/code/.git
RUN rm -rf /opt/code/priv

WORKDIR /opt/app
CMD /opt/app/bin/archethic_node foreground
24 changes: 21 additions & 3 deletions lib/archethic/governance/code/cicd/docker/cicd.ex
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,29 @@ defmodule Archethic.Governance.Code.CICD.Docker do
end
end

defp testnet_cleanup(_dir, 1, _address_encoded), do: 1

defp testnet_cleanup(dir, code, address_encoded) do
Logger.info("#{dir} Cleanup", address: address_encoded)
System.cmd("docker-compose", ["-f", compose_file(dir), "down", "--volumes"], @cmd_options)

System.cmd(
"docker-compose",
[
"-f",
compose_file(dir),
"down",
"--volumes"
],
@cmd_options
)

docker([
"image",
"rm",
"-f",
"archethic-cd",
"archethic-ci",
"prom/prometheus"
])

File.rm_rf!(dir)
code
end
Expand Down

0 comments on commit dcad60b

Please sign in to comment.