Merge pull request #7433 from issyl0/lint-dockerfile

Lint the homebrew/brew Dockerfile with `hadolint`
This commit is contained in:
Mike McQuaid 2020-04-26 13:39:09 +01:00 committed by GitHub
commit 3911ff4080
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 34 deletions

View File

@ -161,6 +161,12 @@ jobs:
brew install vale
vale docs/
- name: Lint Dockerfile
if: matrix.os == 'ubuntu-latest'
run: |
brew install hadolint
hadolint Dockerfile
- name: Build Docker image
if: matrix.os == 'ubuntu-latest'
run: |

View File

@ -1,48 +1,51 @@
FROM ubuntu:xenial
LABEL maintainer="Shaun Jackman <sjackman@gmail.com>"
# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get install -y --no-install-recommends software-properties-common \
&& add-apt-repository -y ppa:git-core/ppa \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
curl \
file \
fonts-dejavu-core \
g++ \
git \
libz-dev \
locales \
make \
netbase \
openssh-client \
patch \
sudo \
uuid-runtime \
tzdata \
&& rm -rf /var/lib/apt/lists/*
&& apt-get install -y --no-install-recommends software-properties-common \
&& add-apt-repository -y ppa:git-core/ppa \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
bzip2 \
ca-certificates \
curl \
file \
fonts-dejavu-core \
g++ \
git \
libz-dev \
locales \
make \
netbase \
openssh-client \
patch \
sudo \
uuid-runtime \
tzdata \
&& rm -rf /var/lib/apt/lists/*
RUN localedef -i en_US -f UTF-8 en_US.UTF-8 \
&& useradd -m -s /bin/bash linuxbrew \
&& echo 'linuxbrew ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers
ADD . /home/linuxbrew/.linuxbrew/Homebrew
&& useradd -m -s /bin/bash linuxbrew \
&& echo 'linuxbrew ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers
COPY . /home/linuxbrew/.linuxbrew/Homebrew
ARG FORCE_REBUILD
# hadolint ignore=DL3003
RUN cd /home/linuxbrew/.linuxbrew \
&& mkdir -p bin etc include lib opt sbin share var/homebrew/linked Cellar \
&& ln -s ../Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin/ \
&& cd /home/linuxbrew/.linuxbrew/Homebrew \
&& git remote set-url origin https://github.com/Homebrew/brew
&& mkdir -p bin etc include lib opt sbin share var/homebrew/linked Cellar \
&& ln -s ../Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin/ \
&& cd /home/linuxbrew/.linuxbrew/Homebrew \
&& git remote set-url origin https://github.com/Homebrew/brew
WORKDIR /home/linuxbrew
ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH \
SHELL=/bin/bash
SHELL=/bin/bash
# Install portable-ruby, tap homebrew/core, install audit gems, and cleanup
RUN HOMEBREW_NO_ANALYTICS=1 HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/core \
&& chown -R linuxbrew: /home/linuxbrew/.linuxbrew \
&& chmod -R g+w,o-w /home/linuxbrew/.linuxbrew \
&& rm -rf ~/.cache \
&& brew install-bundler-gems \
&& brew cleanup
&& chown -R linuxbrew: /home/linuxbrew/.linuxbrew \
&& chmod -R g+w,o-w /home/linuxbrew/.linuxbrew \
&& rm -rf ~/.cache \
&& brew install-bundler-gems \
&& brew cleanup