'Building an Odoo14 image using docker how to copy config file content from local file to a file inside dockerfile

I am a beginner in docker and I am trying to build an Odoo image for this I am creating a Dockerfile but I am blocked on a step since I don't know which command to use exactly to copy a config file content into the config file that should be created inside the image:

the content would be something like this


admin_passwd = *******
db_host = False
db_port = False
db_user = user
db_password = False
addons_path = /opt/odoo1/odoo/addons, /opt/odoo1/odoo-custom-addons

and my Dockerfile is like this :


# syntax=docker/dockerfile:1
#use centos image
FROM centos

#install python git and gcc libs

RUN sudo yum install python3 python3-devel git gcc sassc redhat-rpm-config libxslt-devel  \
    bzip2-devel openldap-devel libjpeg-devel freetype-devel

#creating a user for the odoo installation
RUN sudo useradd -m -U -r -d /opt/odoo1 -s /bin/bash odoo1

#installing postgresql

RUN sudo yum install @pstgresql:12

#create a new PostgreSQL database cluster

RUN sudo postgresql-setup initdb

#Enable and start the PostgreSQL service

RUN sudo systemctl enable --now postgresql

#Create a PostgreSQL user with the same name as the previously created system user

RUN sudo su - postgres -c "createuser -s odoo1"

#Install the required Python modules 

CMD pip3 install -r odoo/requirements.txt

#deactivate the envoronement

RUN deactivate

#Create a new directory for the custom addons and switch to sudo user

CMD mkdir /opt/odoo1/odoo-custom-addons && exit

#Create a configuration file with the following content

CMD touch /etc/odoo1.conf


So I am wondering what is the best way to copy the content of the local config file inside my oddo1.conf file ?

Any help advice or remark will be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source