How to deploy imgproxy to Google Cloud using Docker and Cloud Run

May 27, 2020

Goal

Be able to host a production instance of imgproxy on Google Cloud within minutes.

First time installation

  1. Open the Cloud Terminal

  2. Follow the Before you begin section listed here (https://cloud.google.com/container-registry/docs/pushing-and-pulling)

    • $ sudo usermod -a -G docker ${USER}
    • $ gcloud auth configure-docker
  3. Pull the latest docker image (https://docs.imgproxy.net/#/installation)

    • $ docker pull darthsim/imgproxy:latest
  4. Tag the container

    • $ docker tag darthsim/imgproxy gcr.io/xxxxx-public-assets/imgproxy
  5. Push the container

    • $ docker push gcr.io/xxxxx-public-assets/imgproxy
    • Copy the sha (i.e. sha256:12345...54321)
  6. Head to Cloud Run

  7. Create Service

    • Enter your service name (i.e. xxxxx-imgproxy-production)
    • Click Allow unauthenticated invocations
    • Hit Next, click Select on the input and search for the desired image
      • Alternatively, manually build the url and paste the sha (or gcr.io/xxxxx-public-assets/imgproxy@sha256:12345...54321)
  8. Add any environment variables like IMGPROXY_KEY and IMGPROXY_SALT

Updating the image

  1. Open the Cloud Terminal

  2. Follow the Before you begin section listed here (https://cloud.google.com/container-registry/docs/pushing-and-pulling)

    • $ sudo usermod -a -G docker ${USER}
    • $ gcloud auth configure-docker
  3. Pull the latest docker image (https://docs.imgproxy.net/#/installation)

    • $ docker pull darthsim/imgproxy:latest
  4. Tag the container

    • $ docker tag darthsim/imgproxy gcr.io/xxxxx-public-assets/imgproxy
  5. Push the container

    • $ docker push gcr.io/xxxxx-public-assets/imgproxy
    • Copy the sha (i.e. sha256:12345...54321)
  6. Head to Cloud Run

  7. Click on the name of the service you wish to update (i.e. xxxxx-imgproxy-production)

  8. Click Edit & Depoly New Revision at the top of the page

  9. Slick Select on the input and search for the desired image

    • Alternatively, manually build the url and paste the sha (or gcr.io/xxxxx-public-assets/imgproxy@sha256:12345...54321)