Deploying with docker gives "Cache mounts MUST be in the format --mount=type=cache,id="

marcusglowe
BIZCLASS

a year ago

This works when I deploy these dockerfiles on an ecs container (via ecr)

I don't really need to use Docker on railway, but i would prefer not to remove / rename these dockerfiles, so if possible can you disable autodetecting Docker?

0 Replies

marcusglowe
BIZCLASS

a year ago

32495aae-4b01-4a90-badf-1d53d394b8cd


a year ago

You would need to either remove or rename them, or update your dockerfile accordingly


marcusglowe
BIZCLASS

a year ago

do you know why these docker files don't work on railway but they work on ECS?


a year ago

because the cache mounts must be in the format --mount=type=cache,id=s/


marcusglowe
BIZCLASS

a year ago

yeah but why?


a year ago

that's how railway expects them


marcusglowe
BIZCLASS

a year ago

is this documented somewhere


a year ago

yes -


marcusglowe
BIZCLASS

a year ago

ok, if i set a railwy config, will that supersede wahtever is automatically selecting this Dockerfile?


a year ago

there is no way to disable the auto detection of the Dockerfile


a year ago

they would need to be moved elsewhere, renamed, or removed


marcusglowe
BIZCLASS

a year ago

yeah, don't really want to change our prod setup just to see if railway works for us :/


a year ago

you could always create a branch that has the applicable changes on the Dockerfile for testing on Railway


marcusglowe
BIZCLASS

a year ago

yeah i just think the named Dockerfile would ideally be where our production build lives. Feels like there should be a way to turn this off


marcusglowe
BIZCLASS

a year ago

do you see anything wrong with this part of the dockerfile vs what railway is expecting?

RUN --mount=type=cache,id=s/39cf0fd8-0e6b-4bef-8f82-2e5865bddac1-/var/cache/apk,target=/var/cache/apk \
  ln -vsf /var/cache/apk /etc/apk/cache \
  && apk add --update curl git findutils python3 make gcc g++ musl-dev \
  jpeg-dev cairo-dev giflib-dev pango-dev

marcusglowe
BIZCLASS

a year ago

i am still getting the same error


a year ago

is that your service id?


marcusglowe
BIZCLASS

a year ago

i think so, i copied it from the dashboard


a year ago

you mean the URL?


marcusglowe
BIZCLASS

a year ago

no, i did the command + k instructions from the docs you sent


marcusglowe
BIZCLASS

a year ago

this

1244792084741881900


a year ago

do you have other cache mounts in the dockerfile?


marcusglowe
BIZCLASS

a year ago

bind mounts


a year ago

bind mounts are not supported


a year ago

I don't think that's mentioned in the docs


marcusglowe
BIZCLASS

a year ago

guess i should just drop these


a year ago

yep


marcusglowe
BIZCLASS

a year ago

Looks like I can set the railway dockerfile path successfully to something else, which also works for us but is annoying to have to maintain multiple dockerfiles e.g. these cache mounts make it faster to do installs, etc, especially for dev


a year ago

yep but afaik you can't set it to something that doesn't exist and have it skip using a dockerfile


marcusglowe
BIZCLASS

a year ago

correct, but i needed to fork my dockerfile anyways to support railway's more limited functionality


marcusglowe
BIZCLASS

a year ago

so I just set it to Dockerfile.railway


a year ago

perfect


marcusglowe
BIZCLASS

a year ago

i think i'm close but one of my docker images is giving me an error here that i'm not getting in prod - i'm not sure why this could happen - thought that was the whole point of docker 😂

1244808210674749400


marcusglowe
BIZCLASS

a year ago

have you seen anything like this? did some searching, but haven't found a solution


marcusglowe
BIZCLASS

a year ago

alternatively is there an easy way for me to ssh into the box / understand what's inside the built version of this container besides adding echo statements?


a year ago

havent seen this error before, and theres no ssh.

are you using nixpacks or a dockerfile right now?


marcusglowe
BIZCLASS

a year ago

dockerfile


a year ago

forgive me for asking, but how have you confirmed that?


marcusglowe
BIZCLASS

a year ago

1244841227778789400
1244841228025991200


marcusglowe
BIZCLASS

a year ago

also from the build logs

1244841582478491600


a year ago

sounds good to me, but yeah unfortunately I haven't seen that issue before, are you able to build and run this locally with buildkit


marcusglowe
BIZCLASS

a year ago

hmm, yeah - tho our setup in prod is moreso what i'm trying to mirror


marcusglowe
BIZCLASS

a year ago

Here's our github action for pushing this image, incase anything looks like we're doing something incompatible with railway

  push_worker_image:
    environment: ${{ inputs.environment }}
    name: 'Push Job Queue Worker Image'
    runs-on: warp-ubuntu-latest-x64-4x
    env:
      NODE_ENV: ${{ secrets.NODE_ENV }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-east-2

      - name: Login to Amazon ECR
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v2

      - name: Build and push
        uses: docker/build-push-action@v5
        with:
          context: .
          build-args: |
            TURBO_TEAM=${{ env.TURBO_TEAM }}
            TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
          cache-from: type=gha
          cache-to: type=gha,mode=min
          file: ./apps/flux/worker/Dockerfile
          platforms: linux/amd64
          provenance: false
          target: prod
          push: true
          tags: ${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_WORKER_REPOSITORY }}:${{ github.sha }}

it's worth noting that we're setting the target to prod - is that possible on railway? if not, I think it will default to this target anyways.


a year ago

this is building and pushing an image, I'm not sure what it has to do with railway because you are not deploying your railway service from an image


marcusglowe
BIZCLASS

a year ago

What is your dockerfile builder doing?


a year ago

fwiw, I don't work for railway.

their builder is building and publishing an image but I'm not sure the relevance of the action you showed


marcusglowe
BIZCLASS

a year ago

Got it- that clarifies a lot. The flair is a bit confusing (lol what is a conductor)
This is the action we’re using to build and push this image we’re deploying to prod where it works. Kinda why I’d expect railway to just work on this but ehh guess I should just find an alternative


a year ago

a conductor is railway's term for moderator.

I'm sure this issue is just a simple misconfiguration somewhere that's being overlooked