fly-apps / dockerfile-rails

Provides a Rails generator to produce Dockerfiles and related files.
MIT License
489 stars 38 forks source link

chown: cannot access 'storage': No such file or directory #113

Closed danwetherald closed 2 months ago

danwetherald commented 3 months ago
#18 [stage-2 4/4] RUN groupadd --system --gid 1000 rails &&     useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash &&     chown -R 1000:1000 db log storage tmp
#18 0.202 chown: cannot access 'storage': No such file or directory
#18 ERROR: process "/bin/sh -c groupadd --system --gid 1000 rails &&     useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash &&     chown -R 1000:1000 db log storage tmp" did not complete successfully: exit code: 1
------
 > [stage-2 4/4] RUN groupadd --system --gid 1000 rails &&     useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash &&     chown -R 1000:1000 db log storage tmp:
0.202 chown: cannot access 'storage': No such file or directory

We are seeing issue when trying to deploy to fly from GH Actions - Why is the storage directory included in this generated line?

# Run and own only the runtime files as a non-root user for security
RUN groupadd --system --gid 1000 rails && \
    useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
    chown -R 1000:1000 db log storage tmp
luizkowalski commented 3 months ago

looks like storage is not being copied over. both your .gitignore and .dockerignore should contain these instructions:

/storage/*
!/storage/.keep

and your storage dir should have a .keep file

luizkowalski commented 2 months ago

I'm gonna go ahead and close this one, please reopen if the issue persists