From c4beea2d0a7e49fb0005bb7092cf6533d15dc314 Mon Sep 17 00:00:00 2001 From: Guilhem Bonnefille Date: Mon, 2 Oct 2023 08:48:25 +0200 Subject: [PATCH] Leverage Docker Layer System (#1191) Dockerfile best practices recommend to move the installation of external dependencies before specific code. This will improve local development experience by improving Docker cache management and it will improve final Docker images compaction by sharing the first layers. --- Dockerfile | 6 +++++- Dockerfile.alpine | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 649bc32..d312df1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,13 @@ FROM ubuntu:20.04 ARG TARGETARCH -COPY ./dist/${TARGETARCH}/ttyd /usr/bin/ttyd + +# Dependencies RUN apt-get update && apt-get install -y --no-install-recommends tini && rm -rf /var/lib/apt/lists/* +# Application +COPY ./dist/${TARGETARCH}/ttyd /usr/bin/ttyd + EXPOSE 7681 WORKDIR /root diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 41378a1..141d56f 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,9 +1,13 @@ FROM alpine ARG TARGETARCH -COPY ./dist/${TARGETARCH}/ttyd /usr/bin/ttyd + +# Dependencies RUN apk add --no-cache bash tini +# Application +COPY ./dist/${TARGETARCH}/ttyd /usr/bin/ttyd + EXPOSE 7681 WORKDIR /root -- 2.43.4