Skip to content

Commit

Permalink
Leverage Docker Layer System (#1191)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
guyou authored Oct 2, 2023
1 parent 7a57d76 commit c4beea2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 5 additions & 1 deletion Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit c4beea2

Please sign in to comment.