Giter VIP home page Giter VIP logo

Comments (9)

nlopezgi avatar nlopezgi commented on September 13, 2024 2

@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.

mattmoor avatar mattmoor commented on September 13, 2024

@duggelz @dlorenc @steren FYI

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.

azymnis avatar azymnis commented on September 13, 2024

@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.

mattmoor avatar mattmoor commented on September 13, 2024

@r2d4 owns some deb rules in the distroless repo.

@dlorenc FYI

from rules_docker.

jschenxiaoyu avatar jschenxiaoyu commented on September 13, 2024

@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.

mattmoor avatar mattmoor commented on September 13, 2024

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.

jmooo avatar jmooo commented on September 13, 2024

@azymnis you ever get an answer to the proper method to apt install something into a bazel built container?

from rules_docker.

azymnis avatar azymnis commented on September 13, 2024

@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.

cnsgsz avatar cnsgsz commented on September 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.