From 9837c093fe9076429c40165980586693ad17112f Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Thu, 6 Feb 2025 18:06:03 +0100 Subject: [PATCH] Update github actions to use ubuntu-22.04 and use old actions file --- .github/workflows/build_and_push.yml | 7 ++--- docker/Dockerfile.dev | 39 ++++++++-------------------- 2 files changed, 15 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/build_and_push.yml index a306871a..49580227 100644 --- a/.github/workflows/build_and_push.yml +++ b/.github/workflows/build_and_push.yml @@ -15,9 +15,10 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.branch || github.ref_name }} + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -60,7 +61,7 @@ jobs: echo "tags=${TAGS}" >> $GITHUB_OUTPUT - name: Build and push - uses: docker/build-push-action@v6 + uses: docker/build-push-action@v5 with: context: . file: ./docker/Dockerfile.dev @@ -68,4 +69,4 @@ jobs: tags: ${{ steps.docker_meta.outputs.tags }} platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new + cache-to: type=local,dest=/tmp/.buildx-cache diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index fed795ea..41b65721 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM ruby:3.4.1-bookworm +FROM ruby:3.4.1-alpine ENV APP_PATH=/var/app ENV BUNDLE_VERSION=2.5.21 @@ -8,29 +8,20 @@ ENV RAILS_PORT=3000 ENV RAILS_ENV=development # Install dependencies for application -RUN dpkg --add-architecture arm64 && \ - apt-get update && apt-get install -y \ - build-essential \ +RUN apk -U add --no-cache \ + build-base \ git \ - postgresql-client:arm64 \ - libpq-dev:arm64 \ - libpq5:arm64 \ + postgresql-dev \ + postgresql-client \ libxml2-dev \ libxslt-dev \ nodejs \ - npm \ + yarn \ imagemagick \ tzdata \ less \ - libyaml-dev \ - gcc \ - g++ \ - make \ - libgeos-dev \ - libproj-dev \ - && npm install -g yarn \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ + yaml-dev \ + gcompat \ && mkdir -p $APP_PATH # Update gem system and install bundler @@ -42,18 +33,10 @@ WORKDIR $APP_PATH COPY ../Gemfile ../Gemfile.lock ../.ruby-version ../vendor ./ -# Set environment variables for compilation -ENV CFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing" \ - CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing" \ - MAKEFLAGS="-j2" \ - BUNDLE_FORCE_RUBY_PLATFORM="true" - -# Install all gems into the image with reduced parallelism for ARM64 +# Install all gems into the image RUN bundle config set --local path 'vendor/bundle' \ - && bundle config set --local jobs 2 \ - && bundle config set build.nokogiri --use-system-libraries \ - && bundle install --retry 3 \ - && rm -rf vendor/bundle/ruby/3.4.0/cache/*.gem + && bundle install --jobs 4 --retry 3 \ + && rm -rf vendor/bundle/ruby/3.3.0/cache/*.gem # Copy the rest of the application COPY ../. ./