Comment modifier un Dockerfile ?

J’ai quelques autres conteneurs Docker et j’exécute des étapes comme suit :

# Copie le contenu du répertoire actuel dans le conteneur à l'adresse /app
COPY html /usr/share/nginx/html/
COPY dim.local.crt /etc/nginx/ssl/
COPY dim.local.key /etc/nginx/ssl/
COPY nginx.conf /etc/nginx/
COPY default.conf /etc/nginx/sites-enabled/

# Installe les packages nécessaires spécifiés dans requirements.txt
#RUN pip install -r requirements.txt

# Faut-il redémarrer nginx après les commandes COPY ?
RUN 

RUN apt-get update \
    && apt-get install -y nano \
    && rm -fr /var/lib/apt/lists/*

Je dois effectuer des étapes similaires pour mon conteneur Discourse, mais où se trouve le Dockerfile ? J’ai lu qu’on pourrait peut-être les ajouter à la fin de containers/app.yml, mais je ne suis pas confiant.

Quelqu’un peut-il m’expliquer ?

Can you explain exactly what you need?

There is no need to mess with docker file to add a custom certificate, we have a guide for that at Advanced Setup Only: Allowing SSL / HTTPS for your Discourse Docker setup

1 « J'aime »

I don’t want to do the exact same thing. I just have shell scripts and a crontab the I want to copy in to the container so I can automate some tasks.

The last 5 lines of the app.yml contain an example of running custom commands, for example adding

- exec: curl example.com/script.sh | bash

Will download an execute that script.

1 « J'aime »

Yup, I see that, but each time I rebuild I get copy errors:

## Any custom commands to run after building
run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
  
  - exec: cp /shared/rr/run_badges.sh /etc/cron.d/.
  - exec: cp /shared/rr/badges /etc/cron.d/.
  - exec: echo "End of custom commands"

Please share the error log too.

I could indeed pull them from a url, that is a thought

The files are indeed present on the host:

# ls -al shared/rr/
badges         run_badges.sh
#

Here is the error:

FAILED
--------------------
Pups::ExecError: cp /shared/rr/run_badges.sh /etc/cron.d/. failed with return #<Process::Status: pid 1457 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params "cp /shared/rr/run_badges.sh /etc/cron.d/."
e23ff12630c8058c4b36ee8673404dafbe6791ec61aa630f1224400eba4e75e0
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

The /shared dir inside the container is mapped, by default, to /var/discourse/shared/standalone so you are missing a directory in there.

1 « J'aime »

What mistake am I making @Falco

command:

- exec: cp /shared/standalone/sql/run_badges.sh /root
Pups::ExecError: cp /shared/standalone/sql/run_badges.sh /root failed with return #<Process::Status: pid 1728 exit 1>

actually, this solution works pretty nicely. Thanks for mentioning it.

1 « J'aime »