Docker image: adding files to two different locations

31 views
Skip to first unread message

Charlie White

unread,
Mar 27, 2018, 12:06:45 PM3/27/18
to bazel-discuss
I'm building a simple docker container with rules_docker.  I need to move some python files to one directory, and the corresponding configuration files to another.  I have added a "files" option to my container_image, and I have specified a directory.  But, that will place all files in the same directory.  How do I split them into two different directories?

thanks

Charlie White

unread,
Mar 27, 2018, 1:12:05 PM3/27/18
to bazel-discuss
Maybe a bit more information on what I am trying to do will help.
I am taking the standard datadog agent image, adding a few files to it so their agent runs my code, and install any necessary packages.  

The docker file for this looks like this:
FROM  datadog/docker-dd-agent

# file generated by pipreqs
ADD requirements.txt /tmp

# place check code and config to the necessary locations
ADD sla_monitor/rt-check.py /etc/dd-agent/checks.d
ADD sla_monitor/batch-check.py /etc/dd-agent/checks.d
ADD sla_monitor/kpi-check.py /etc/dd-agent/checks.d

ADD sla_monitor/conf/rt-check.yaml /etc/dd-agent/conf.d
ADD sla_monitor/conf/batch-check.yaml /etc/dd-agent/conf.d
ADD sla_monitor/conf/kpi-check.yaml /etc/dd-agent/conf.d

# install python libararies necessary for check.
RUN pip install -r /tmp/requirements.txt

So, not only am I struggling on putting files in two different locations, I also need to run pip install on the server to get all the packages in place for my added functionality.

Charlie White

unread,
Mar 27, 2018, 3:42:21 PM3/27/18
to bazel-si...@googlegroups.com, bazel-...@googlegroups.com
Forwarding to baze-sig-python due to pip install issue.

I ended up creating 2 tar files for the config and souce files respectively.  I added a package_dir to both and then added both tars to the container image.  That got my source and config files where I needed, now I need to figure out how to get the pip install to run.

Suggestions?

--
You received this message because you are subscribed to a topic in the Google Groups "bazel-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bazel-discuss/uUXtkymb_H4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bazel-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/9c556545-dc44-41ae-a7a7-a231f08c9f86%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages