Comments (9)
@Fxer download_pkgs and install_pkgs might work for your use case -
https://github.com/GoogleContainerTools/base-images-docker/tree/master/package_managers
from rules_docker.
tl;dr docker_build
avoids RUN
by design because it is a huge can of non-determinism worms, but you should not need it for pip install
(given more complete Bazel support).
Today Bazel has py_binary
, py_library
, and py_test
rules that go in your BUILD
files, but should (and does NOT) have a pip_install
rule that goes in your WORKSPACE
file.
WORKSPACE
is intended to capture your external dependencies and pull them down so that BUILD
does not need anything but its declared dependencies (including a network connection!). Given that Bazel is a universal build/test/packaging system, I like to think of WORKSPACE
as its universal package manager client, where rules like pip_install
are what should be talking to external package services and making those packages available to BUILD
.
git_repository
is easily one of the the most prominent "repository rules", but deals in source. We define docker_pull
here for downloading a base image. Another good example in this space is maven_jar
for downloading Java dependencies from Maven Central (or another Maven package mirror).
You can see some parallel discussion to this on pip here, I am going to resolve this and let that be the canonical issue tracking this.
It is a terrible fallback, but one option to express (a subset of) pip packages using Bazel's existing rules is this.
I hope this answers your question and that we can get a repository rule for pip out sooner than later. Thanks for reaching out.
from rules_docker.
@mattmoor thanks for the explanation. I get it that RUN commands are a huge pain regarding non -determinism. One more (slightly) related question that I had was what to do regarding pulling debian packages that are not in the standard debian repos. In my case i need to pull a few packages for ROS (robot operating system). I can do this in a Dockerfile
like this:
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
RUN apt-get update
RUN apt-get install ros-jade-rospy-message-converter
How would I do something like that in a docker bazel rule?
from rules_docker.
@r2d4 owns some deb
rules in the distroless
repo.
@dlorenc FYI
from rules_docker.
@mattmoor I have a problem when using uwsgi
. I have to install it by pip install uwsgi
and then start the server using uwsgi xxx
command. So how can I start uwsgi
service using rules_docker
?
from rules_docker.
Can you open a separate issue? I think the tl;dr is entrypoint
, but there are a lot of things to get wrong before that.
from rules_docker.
@azymnis you ever get an answer to the proper method to apt install
something into a bazel built container?
from rules_docker.
@Fxer no. What I end up doing is just creating base images with any Debian packages that I need and just rooting my docker bazel build rules from there. Does that make sense?
from rules_docker.
With bazel's support for pip_install, is the recommended to handle python dependencies with that rather than rules_docker?
from rules_docker.
Related Issues (20)
- When sandbox network is disabled rules_docker rules cannot communicate with docker daemon HOT 1
- Multi-Architecture Support for container_run_and_commit HOT 1
- Shelless invocation for container_run_and_commit HOT 1
- Support multiple python versions in py3_image's py_binary HOT 1
- Support image labels/annotations HOT 1
- Default to Bazel target architecture HOT 2
- Bad timezone for Marocco with @go_image_base//image
- Use binary output from go_binary for go_image
- `container_run_and_extract` does not work with Podman HOT 1
- How to properly use dockerfile_image? HOT 4
- How to get the coredump file in container?
- Sporadic failures of `wrong number of hex digits for sha256`
- The `workdir` for `cc_image` is not the runfiles directory by default.
- go_image always builds for linux/amd64 irrespective of host platform
- rules_nodejs and rules_docker conflict
- container_pull failed for images layers with MediaType "application/vnd.docker.image.rootfs.diff.tar"
- portable_mtime for py3_image
- Support Native Bazel Tags for Build Querying
- py3_image: No Matching Toolchains Found
- rules_docker fails to build with HEAD bazel
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_docker.