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

2 years 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?

48 Replies

marcusglowe
PROOP

2 years ago

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


brody
EMPLOYEE

2 years ago

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


marcusglowe
PROOP

2 years ago

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


brody
EMPLOYEE

2 years ago

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


marcusglowe
PROOP

2 years ago

yeah but why?


brody
EMPLOYEE

2 years ago

that's how railway expects them


marcusglowe
PROOP

2 years ago

is this documented somewhere


brody
EMPLOYEE

2 years ago

yes -


marcusglowe
PROOP

2 years ago

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


brody
EMPLOYEE

2 years ago

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


brody
EMPLOYEE

2 years ago

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


marcusglowe
PROOP

2 years ago

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


brody
EMPLOYEE

2 years ago

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


marcusglowe
PROOP

2 years 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
PROOP

2 years 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
PROOP

2 years ago

i am still getting the same error


brody
EMPLOYEE

2 years ago

is that your service id?


marcusglowe
PROOP

2 years ago

i think so, i copied it from the dashboard


brody
EMPLOYEE

2 years ago

you mean the URL?


marcusglowe
PROOP

2 years ago

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


marcusglowe
PROOP

2 years ago

this

1244792084741881900


brody
EMPLOYEE

2 years ago

do you have other cache mounts in the dockerfile?


marcusglowe
PROOP

2 years ago

bind mounts


brody
EMPLOYEE

2 years ago

bind mounts are not supported


brody
EMPLOYEE

2 years ago

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


marcusglowe
PROOP

2 years ago

guess i should just drop these


brody
EMPLOYEE

2 years ago

yep


marcusglowe
PROOP

2 years 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


brody
EMPLOYEE

2 years ago

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


marcusglowe
PROOP

2 years ago

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


marcusglowe
PROOP

2 years ago

so I just set it to Dockerfile.railway


brody
EMPLOYEE

2 years ago

perfect


marcusglowe
PROOP

2 years 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
PROOP

2 years ago

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


marcusglowe
PROOP

2 years 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?


brody
EMPLOYEE

2 years ago

havent seen this error before, and theres no ssh.

are you using nixpacks or a dockerfile right now?


marcusglowe
PROOP

2 years ago

dockerfile


brody
EMPLOYEE

2 years ago

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


marcusglowe
PROOP

2 years ago

1244841227778789400
1244841228025991200


marcusglowe
PROOP

2 years ago

also from the build logs

1244841582478491600


brody
EMPLOYEE

2 years 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
PROOP

2 years ago

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


marcusglowe
PROOP

2 years 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.


brody
EMPLOYEE

2 years 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
PROOP

2 years ago

What is your dockerfile builder doing?


brody
EMPLOYEE

2 years 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
PROOP

2 years 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


brody
EMPLOYEE

2 years ago

a conductor is railway's term for moderator.

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


Loading...