Skip to content

Commit a765636

Browse files
committed
Dockerfile: Consistent cleanup after apt-get and formatting
1 parent c90bd35 commit a765636

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

template/{{app_name}}/Dockerfile.jinja

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,16 @@ EXPOSE {{ app_local_port }}
2727
FROM base AS build
2828

2929
# Install packages needed to build gems
30-
RUN apt-get update -qq && \
31-
apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config npm
30+
RUN apt-get update -qq \
31+
&& apt-get install --no-install-recommends -y \
32+
build-essential \
33+
git \
34+
libpq-dev \
35+
libvips \
36+
pkg-config \
37+
npm \
38+
&& apt-get clean \
39+
&& rm -rf /var/lib/apt/lists/*
3240

3341
# Install npm packages
3442
COPY package.json package-lock.json ./
@@ -45,9 +53,12 @@ FROM build AS dev
4553
ENV RAILS_ENV="development"
4654

4755
# Install packages needed for development
48-
RUN apt-get update -qq && \
49-
apt-get install --no-install-recommends -y postgresql-client graphviz && \
50-
rm -rf /var/lib/apt/lists /var/cache/apt/archives
56+
RUN apt-get update -qq \
57+
&& apt-get install --no-install-recommends -y \
58+
postgresql-client \
59+
graphviz \
60+
&& apt-get clean \
61+
&& rm -rf /var/lib/apt/lists/*
5162

5263
# Install application gems for development
5364
COPY Gemfile Gemfile.lock ./
@@ -106,7 +117,8 @@ RUN apt-get update -qq \
106117
python3-venv \
107118
unzip \
108119
wget \
109-
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives \
120+
&& apt-get clean \
121+
&& rm -rf /var/lib/apt/lists/* \
110122
&& curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" \
111123
&& unzip awscli-bundle.zip \
112124
&& ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws \

0 commit comments

Comments
 (0)