Dockerfile caching?
Hello, I have done some modifications on my dockerfile but seems it is catching the changes and not "reading" the new values, so It's not adding them to the built image, any ideas how to avoid catching or how to force to clear cache?
Thanks!
54 Replies
Project ID:
40e44f3c-0508-45c6-b255-a4558921d6f5
40e44f3c-0508-45c6-b255-a4558921d6f5
the builder should detect there is a change and invalidate the cache, your problem is likely something else
Thanks @Brody for the response, let me explain what I'm trying to do.
I have an n8n instance running on queue mode. I need to install some npm dependencies that I would like to use and those need to be installed on my /usr/local/lib/node_modules/n8n
I added this line to my Dockerfile:
RUN /tmp/install_modules.sh
This is my script (install_modules.sh):
(enclose the code in triple backticks)
This is the deployment log:
please
how?
you are currently doing one backtick, do 3 instead
done
does n8n not have a native way of doing this?
nope...
I wish it had one
but for external modules (npm) you need to install them manually
send the dockerfile
do you see the
Custom modules installed.
message in the build logsyes
but also I see errors so probably modules not being installed
looks like the modules you are installing conflict with the already installed modules, you might have to specify version of the modules that are compatible
let me try only with aws-sdk which I'm pretty sure should not be in the list
@Brody is railway down?
I can't see variables
yes they are lol
and everytime I refresh page looks like this
yeah just try again in 15 mins
Ok, I have to afk for 45-60 minutes then I will try again. Thank you for your help. I hope I can solve this soon I'm not doing anything overcomplex, just I want to install npm libraries in a specific folder
sounds good, ill be around
I'm trying to install one by one and see
#5 [2/2] RUN npm install aws-sdk
#5 2.496 npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
well that is just a warning
yeah I know just wondering that won't cause any future issues, I guess should not be the case
it shouldn't
still having same issues of this image:
dunno why...
looks like something is not compatible with these packages
that image has like 3 pixels total, I can't read a single word
still have dependency issues
how do other people install extra node modules?
Omg
I fixed it
what a dumb
this made the difference
the command
USER root
interesting, I didn't see anything about permission errors
yep... but now it works
do you know if I can pass a variable content to dockerfile?
you mean for the ARGs
yeah
instead of hard-texting the modules there
I want to use variable if possible
all service variables are available via the ARGS
so in this case my variable name is CUSTOM_MODULES
should i use $CUSTOM_MODULE
?
RUN npm install -g $CUSTOM_MODULE
read this please https://docs.railway.app/deploy/dockerfiles#environment-variables
Thank you!
I think I got it:
fun fact, you dont need most of the ARG lines, and all of those ENV lines, as railway will automatically inject the variables to the environment when it runs the built image
you only use
CUSTOM_MODULES
during the build, so youd only need to do ARG CUSTOM_MODULES
oh really? Interesting
im like 98% sure thats how it works
Thank you so much mate for your help. I really appreciate the time you spend here with me. Thank you! I have started using Railway a few days ago. I'm actually running an instance on AWS, but it's very time-consuming each time I need to make changes / deploy / upgrade, etc. I'm super happy to have discovered this fantastic tool and super sad I didn't discover it before, LOL
love to here it!! 🙂