in this example, I copy wait-for-it.sh inside /app/wait-for-it.sh But, I don't want to save wait-for-it.sh in my local directory. I want to download it using curl and then copy into /app/wait-for-it.sh
FROM prismagraphql/prisma:1.34.8
COPY ./wait-for-it.sh /app/wait-for-it.sh
RUN chmod +x /app/wait-for-it.sh
ENTRYPOINT ["/bin/sh","-c","/app/wait-for-it.sh mysql:3306 --timeout=0 -- /app/start.sh"]
What I have tried is this, but how can I get the wait-for-it.sh
after downloading the file using curl command:
FROM prismagraphql/prisma:1.34.8
FROM node:11-slim
RUN apt-get update && apt-get install -yq build-essential dumb-init
RUN curl -LJO https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh
COPY wait-for-it.sh /app/wait-for-it.sh
RUN chmod +x /wait-for-it.sh
ENTRYPOINT ["/bin/sh","-c","/wait-for-it.sh mysql:3306 --timeout=0 -- /app/start.sh"]
Introduction : cURL is both a command line utility and library. One can use curl to download file or transfer of data/file using many different protocols such as HTTP, HTTPS, FTP, SFTP and more. The curl command line utility lets you fetch a given URL or file from the bash shell.
Based on your comments below, you may try this one:
FROM prismagraphql/prisma:1.34.8
RUN apk update && apk add build-base dumb-init curl
RUN curl -LJO https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh
RUN cp wait-for-it.sh /app/
RUN chmod +x /wait-for-it.sh
ENTRYPOINT ["/bin/sh","-c","/wait-for-it.sh mysql:3306 --timeout=0 -- /app/start.sh"]
Note: You need to use cp
command as you want to copy the script from one location to another within your container's filesystem.
You can also confirm the presence of your script and other files/dirs in the /app
folder by running the command:
$ docker run --rm --entrypoint ls waitforit -l /app/
total 36
drwxr-xr-x 1 root root 4096 Aug 29 2019 bin
drwxr-xr-x 2 root root 16384 Aug 29 2019 lib
-rwxr-xr-x 1 root root 462 Aug 29 2019 prerun_hook.sh
-rwxr-xr-x 1 root root 61 Aug 29 2019 start.sh
-rw-r--r-- 1 root root 5224 Apr 22 13:46 wait-for-it.sh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With