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.
This commit is contained in:
Guilhem Bonnefille
2023-10-02 08:48:25 +02:00
committed by GitHub
parent 7a57d76721
commit c4beea2d0a
2 changed files with 10 additions and 2 deletions

View File

@@ -1,9 +1,13 @@
FROM ubuntu:20.04 FROM ubuntu:20.04
ARG TARGETARCH 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/* 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 EXPOSE 7681
WORKDIR /root WORKDIR /root

View File

@@ -1,9 +1,13 @@
FROM alpine FROM alpine
ARG TARGETARCH ARG TARGETARCH
COPY ./dist/${TARGETARCH}/ttyd /usr/bin/ttyd
# Dependencies
RUN apk add --no-cache bash tini RUN apk add --no-cache bash tini
# Application
COPY ./dist/${TARGETARCH}/ttyd /usr/bin/ttyd
EXPOSE 7681 EXPOSE 7681
WORKDIR /root WORKDIR /root