Skip to content

Commit

Permalink
chore: Added Hadolint check in CI and fixed Dockerfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk authored Apr 29, 2023
1 parent 40d77db commit 7fd4cfa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
&& tar -xz -C /tmp -f "/tmp/docker-${DOCKER_VERSION}.tgz" \
&& mv /tmp/docker/* /usr/bin \
&& docker --version
- run:
name: Lint Dockerfile
command: docker run --rm -i hadolint/hadolint < Dockerfile
- run:
name: Install goss
command: curl -fsSL https://goss.rocks/install | sh && goss --version
Expand Down
36 changes: 16 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
FROM php:8.1-cli
LABEL Maintainer="Alex Skrypnyk <[email protected]>"

LABEL org.opencontainers.image.authors="Alex Skrypnyk <[email protected]>" maintainer="Alex Skrypnyk <[email protected]>"

# Ensure temporary files are not retained in the image.
VOLUME /tmp

# Install git and ssh.
# hadolint ignore=DL3008
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends git openssh-client lsof zip unzip vim lynx curl aspell-en jq tree rsync

RUN git --version \
&& ssh -V \
&& lsof -v \
&& zip --version \
&& unzip -v \
&& vim --version \
&& lynx --version \
&& curl --version \
&& aspell --version \
&& jq --version \
&& tree --version
&& apt-get install -y --no-install-recommends git openssh-client lsof zip unzip vim lynx curl aspell-en jq tree rsync \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install shellcheck
# @see https://github.com/koalaman/shellcheck/releases
Expand All @@ -37,9 +28,9 @@ RUN curl -L -o "/tmp/docker-${DOCKER_VERSION}.tgz" "https://download.docker.com/
&& tar -xz -C /tmp -f "/tmp/docker-${DOCKER_VERSION}.tgz" \
&& mv /tmp/docker/* /usr/bin \
&& docker --version \
&& mkdir -p $HOME/.docker/cli-plugins \
&& curl -sSL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $HOME/.docker/cli-plugins/docker-compose \
&& chmod +x $HOME/.docker/cli-plugins/docker-compose \
&& mkdir -p "$HOME/.docker/cli-plugins" \
&& curl -sSL "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o "$HOME/.docker/cli-plugins/docker-compose" \
&& chmod +x "$HOME/.docker/cli-plugins/docker-compose" \
&& docker compose version

# Install Docker Compose V1 (docker-compose).
Expand All @@ -61,6 +52,7 @@ RUN mkdir -vp ~/.docker/cli-plugins \
ENV COMPOSER_VERSION=2.5.5
ENV COMPOSER_SHA=55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae
ENV COMPOSER_ALLOW_SUPERUSER=1
# hadolint ignore=DL4006
RUN curl -L -o "/usr/local/bin/composer" "https://getcomposer.org/download/${COMPOSER_VERSION}/composer.phar" \
&& echo "${COMPOSER_SHA} /usr/local/bin/composer" | sha256sum \
&& chmod +x /usr/local/bin/composer \
Expand All @@ -72,13 +64,15 @@ ENV PATH /root/.composer/vendor/bin:$PATH
# @see https://github.com/nvm-sh/nvm/releases
ENV NVM_VERSION=v0.39.3
ENV NVM_DIR=/root/.nvm
# hadolint ignore=DL4006,SC1091
RUN mkdir -p "${NVM_DIR}" \
&& curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_VERSION}/install.sh" | bash \
&& . $HOME/.nvm/nvm.sh \
&& . "$HOME/.nvm/nvm.sh" \
&& nvm --version

ENV SHIPPABLE_NODE_VERSION=v19.9.0
RUN . $HOME/.nvm/nvm.sh \
# hadolint ignore=SC1091
RUN . "$HOME/.nvm/nvm.sh" \
&& nvm install "${SHIPPABLE_NODE_VERSION}" \
&& nvm alias default "${SHIPPABLE_NODE_VERSION}" \
&& nvm use default \
Expand All @@ -89,12 +83,14 @@ ENV PATH ${NVM_DIR}/versions/node/${SHIPPABLE_NODE_VERSION}/bin:$PATH
# @see https://github.com/aelsabbahy/goss
ENV GOSS_VER=v0.3.22
ENV GOSS_FILES_STRATEGY=cp
# hadolint ignore=DL4006
RUN curl -fsSL https://goss.rocks/install | sh \
&& goss --version

# Install Bats.
# @see https://github.com/bats-core/bats-core/releases
ENV BATS_VERSION=v1.9.0
# hadolint ignore=DL3003
RUN curl -L -o "/tmp/bats.tar.gz" "https://github.com/bats-core/bats-core/archive/${BATS_VERSION}.tar.gz" \
&& mkdir -p /tmp/bats && tar -xz -C /tmp/bats -f /tmp/bats.tar.gz --strip 1 \
&& cd /tmp/bats \
Expand Down
2 changes: 2 additions & 0 deletions versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ commands=(
"curl --version"
"aspell --version"
"jq --version"
"tree --version"
"rsync --version"
"shellcheck --version"
"docker --version"
"docker compose version"
Expand Down

0 comments on commit 7fd4cfa

Please sign in to comment.