Remote docker build fails

I am trying to get remote builder to build my docker image and push it to fly.io registry using:

flyctl deploy --build-only --remote-only --no-cache --push --image registry.fly.io/APPNAME --image-label latest -a APPNAME --verbose

What I back is:

==> Verifying app config Validating /Users/philip/projects/.../fly.toml ✓ Configuration is valid --> Verified app config ==> Building image Searching for image 'registry.fly.io/tldl-workers' remotely... Error: failed to fetch an image or build from source: image must be amd64 architecture for linux os, found arm64 linux
Now, I did try building and pushing an image directly to fly.io from my Mac (knowing it won’t really run). So I am stuck now?

From what I can see, there is no way to specify what platform to use when running the fly build command, so I would reccomend building the image first using the docker build --platform=linux/amd64 command, then pushing it to fly registry, and then deploying the app.

Let me know if you get stuck

Are you building from a Dockerfile or trying to use an existing image?

Thanks for the replies guys. The image is based on:

FROM python:3.11-slim as python-base

I ended up moving the whole thing over into GH actions (where it truly belongs, tbh). Sharing my workflow code for the posterity:

name: Fly Images
on:
  push:
    paths:
      - "server/workers/**"
jobs:
  tests:
    runs-on: ubuntu-latest
    name: Run tests
    steps:
      - uses: actions/checkout@v4

      - name: Run tests
        working-directory: "server/workers"
        run: docker build --no-cache --target test .
  deploy:
    name: Build and push worker image
    needs: tests
    runs-on: ubuntu-latest
    concurrency: deploy-group
    env:
      FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
    steps:
      - uses: actions/checkout@v4
      - uses: superfly/flyctl-actions/setup-flyctl@master
      - name: Auth Fly Docker
        run: flyctl auth docker
      - name: Build docker image
        working-directory: "server/workers"
        run: docker build -t registry.fly.io/IMAGE_NAME_HERE:latest .
      - name: Push docker image
        run: docker push registry.fly.io/IMAGE_NAME_HERE:latest

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.