diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile index 3641b0b289..2fbf183f9c 100644 --- a/.circleci/Dockerfile +++ b/.circleci/Dockerfile @@ -1,4 +1,4 @@ -FROM cimg/ruby:3.1.0-browsers +FROM cimg/ruby:3.1.6-browsers RUN sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' \ && wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null diff --git a/.circleci/config.yml b/.circleci/config.yml index a7c1f1191b..d78188c036 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -60,7 +60,7 @@ jobs: test: working_directory: ~/figgy docker: - - image: pulibrary/ci-figgy:1.6 + - image: ghcr.io/pulibrary/figgy:latest environment: RAILS_ENV: test FIGGY_DB_HOST: localhost diff --git a/.github/workflows/build-ci-docker.yml b/.github/workflows/build-ci-docker.yml new file mode 100644 index 0000000000..08eea704df --- /dev/null +++ b/.github/workflows/build-ci-docker.yml @@ -0,0 +1,69 @@ +name: Create and publish a Docker CI image + +on: + push: + paths: + - .circleci/Dockerfile + - bin/** + branches: + - main + pull_request: + paths: + - .circleci/Dockerfile + - bin/** + branches: + - main + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=sha + env: + DOCKER_METADATA_PR_HEAD_SHA: true + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: "${{ github.workspace }}" + file: "${{ github.workspace }}/.circleci/Dockerfile" + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + target: "ci" diff --git a/app/derivative_services/geo_derivatives/processors/gdal.rb b/app/derivative_services/geo_derivatives/processors/gdal.rb index 9dd41c7c8d..f8abb2f6b1 100644 --- a/app/derivative_services/geo_derivatives/processors/gdal.rb +++ b/app/derivative_services/geo_derivatives/processors/gdal.rb @@ -47,11 +47,11 @@ def self.compress(in_path, out_path, options) # @param options [Hash] creation options def self.cloud_optimized_geotiff(in_path, out_path, _options) execute("gdal_translate -q -expand rgb \"#{in_path}\" #{out_path} -ot Byte -of COG "\ - "-a_nodata 256 -co COMPRESS=JPEG") + "-a_nodata 256 -co COMPRESS=LZW") rescue StandardError # Try without expanding rgb execute("gdal_translate -q \"#{in_path}\" #{out_path} -ot Byte -of COG "\ - "-a_nodata 256 -co COMPRESS=JPEG") + "-a_nodata 256 -co COMPRESS=LZW") end # Executes a gdal_rasterize command. Used to rasterize vector