From d016891e3ab166951e2bf42ed0e5eee6dbfaed6c Mon Sep 17 00:00:00 2001 From: SAITOU Keita Date: Tue, 6 Aug 2024 17:21:57 +0900 Subject: [PATCH 1/4] =?UTF-8?q?Add:=20run-all-check.sh=E3=81=ABdocker=20ch?= =?UTF-8?q?eck=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli-scripts/run-all-checks.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cli-scripts/run-all-checks.sh b/cli-scripts/run-all-checks.sh index 7816bf3f..3932b402 100755 --- a/cli-scripts/run-all-checks.sh +++ b/cli-scripts/run-all-checks.sh @@ -64,3 +64,13 @@ if [ -n "${HADOLINT}" ]; then else warning "[SKIP] Hadolint, hadolint or Docker is required." fi + +message "##### Run Docker Build Check" +if type docker > /dev/null 2>&1; then + files=$(git ls-files | grep "Dockerfile") + for file in ${files}; do + docker build --check --file "${file}" . + done +else + warning "[SKIP] Docker Check, Docker is required." +fi From 19c7fc922ed61e58e071d228fde20484ee2db9a4 Mon Sep 17 00:00:00 2001 From: SAITOU Keita Date: Tue, 6 Aug 2024 17:28:05 +0900 Subject: [PATCH 2/4] =?UTF-8?q?Add:=20GitHub=20Actions=E3=81=AECheck?= =?UTF-8?q?=E3=81=ABDocker=20Check=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 443c5ad5..b664e28a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -51,3 +51,9 @@ jobs: uses: hadolint/hadolint-action@v3.1.0 with: dockerfile: fly.Dockerfile + + # lint by docker check + - name: Run Docker Build Check for dev.Dockerfile + run: docker build --check --file dev.Dockerfile . + - name: Run Docker Build Check for fly.Dockerfile + run: docker build --check --file fly.Dockerfile . From 63975997069101633fe95296ff69258344b54398 Mon Sep 17 00:00:00 2001 From: SAITOU Keita Date: Tue, 6 Aug 2024 17:28:20 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Refactor:=20docker=20check=E3=81=AB?= =?UTF-8?q?=E5=BE=93=E3=81=84=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fly.Dockerfile | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/fly.Dockerfile b/fly.Dockerfile index 48cbab71..a5010838 100644 --- a/fly.Dockerfile +++ b/fly.Dockerfile @@ -19,7 +19,7 @@ ARG RUBY_VERSION=3.3.4 ARG VARIANT=jemalloc-bullseye-slim -FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-${VARIANT} as base +FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-${VARIANT} AS base SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -33,21 +33,21 @@ ARG BUNDLER_VERSION=2.5.16 ARG RAILS_ENV=production ENV RAILS_ENV=${RAILS_ENV} -ENV RAILS_SERVE_STATIC_FILES true -ENV RAILS_LOG_TO_STDOUT true +ENV RAILS_SERVE_STATIC_FILES=true +ENV RAILS_LOG_TO_STDOUT=true ARG BUNDLE_WITHOUT=development:test ARG BUNDLE_PATH=vendor/bundle -ENV BUNDLE_PATH ${BUNDLE_PATH} -ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT} +ENV BUNDLE_PATH=${BUNDLE_PATH} +ENV BUNDLE_WITHOUT=${BUNDLE_WITHOUT} RUN mkdir /app WORKDIR /app RUN mkdir -p tmp/pids RUN curl https://get.volta.sh | bash -ENV VOLTA_HOME /root/.volta -ENV PATH $VOLTA_HOME/bin:/usr/local/bin:$PATH +ENV VOLTA_HOME=/root/.volta +ENV PATH=$VOLTA_HOME/bin:/usr/local/bin:$PATH RUN volta install node@${NODE_VERSION} yarn@${YARN_VERSION} && \ gem update --system --no-document && \ gem install -N bundler -v ${BUNDLER_VERSION} @@ -56,10 +56,10 @@ RUN volta install node@${NODE_VERSION} yarn@${YARN_VERSION} && \ # install packages only needed at build time -FROM base as build_deps +FROM base AS build_deps ARG BUILD_PACKAGES="build-essential=12.* libpq-dev=13.* libyaml-dev=0.2.*" -ENV BUILD_PACKAGES ${BUILD_PACKAGES} +ENV BUILD_PACKAGES=${BUILD_PACKAGES} # hadolint ignore=DL3008 RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \ @@ -72,7 +72,7 @@ RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt \ # install gems -FROM build_deps as gems +FROM build_deps AS gems COPY Gemfile Gemfile.lock ./ RUN bundle install && \ @@ -82,7 +82,7 @@ RUN bundle install && \ # install node modules -FROM build_deps as node_modules +FROM build_deps AS node_modules COPY package.json yarn.lock .yarnrc.yml ./ COPY .yarn/releases/ ./.yarn/releases/ @@ -126,7 +126,7 @@ RUN chmod +x /app/bin/* && \ # The following enable assets to precompile on the build server. Adjust # as necessary. If no combination works for you, see: # https://fly.io/docs/rails/getting-started/existing/#access-to-environment-variables-at-build-time -ENV SECRET_KEY_BASE 1 +ENV SECRET_KEY_BASE=1 # ENV AWS_ACCESS_KEY_ID=1 # ENV AWS_SECRET_ACCESS_KEY=1 @@ -135,8 +135,8 @@ ARG BUILD_COMMAND="bin/rails fly:build" RUN ${BUILD_COMMAND} # Default server start instructions. Generally Overridden by fly.toml. -ENV PORT 8080 +ENV PORT=8080 ARG SERVER_COMMAND="bin/rails fly:server" -ENV SERVER_COMMAND ${SERVER_COMMAND} +ENV SERVER_COMMAND=${SERVER_COMMAND} # hadolint ignore=DL3025 CMD ${SERVER_COMMAND} From a0b997984a62bf1c858e0eedf0032b8344730edc Mon Sep 17 00:00:00 2001 From: SAITOU Keita Date: Tue, 6 Aug 2024 17:36:22 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Fix:=20Docker=20Build=20Checks=E3=81=A3?= =?UTF-8?q?=E3=81=A6=E5=90=8D=E5=89=8D=E3=81=AB=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check.yml | 6 +++--- cli-scripts/run-all-checks.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b664e28a..00fcbf5c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -52,8 +52,8 @@ jobs: with: dockerfile: fly.Dockerfile - # lint by docker check - - name: Run Docker Build Check for dev.Dockerfile + # lint by docker build checks + - name: Run Docker Build Checks for dev.Dockerfile run: docker build --check --file dev.Dockerfile . - - name: Run Docker Build Check for fly.Dockerfile + - name: Run Docker Build Checks for fly.Dockerfile run: docker build --check --file fly.Dockerfile . diff --git a/cli-scripts/run-all-checks.sh b/cli-scripts/run-all-checks.sh index 3932b402..0a16c24a 100755 --- a/cli-scripts/run-all-checks.sh +++ b/cli-scripts/run-all-checks.sh @@ -65,12 +65,12 @@ else warning "[SKIP] Hadolint, hadolint or Docker is required." fi -message "##### Run Docker Build Check" +message "##### Run Docker Build Checks" if type docker > /dev/null 2>&1; then files=$(git ls-files | grep "Dockerfile") for file in ${files}; do docker build --check --file "${file}" . done else - warning "[SKIP] Docker Check, Docker is required." + warning "[SKIP] Docker Build Checks, Docker is required." fi