Skip to content

Commit

Permalink
fix(docker.bzl): avoid duplicate tags
Browse files Browse the repository at this point in the history
  • Loading branch information
pcj committed Mar 16, 2024
1 parent 5011650 commit e17222a
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 32 deletions.
14 changes: 0 additions & 14 deletions Makefile

This file was deleted.

13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ Provides:
See [releases] page for an `http_archive` of the latest `@pycross_image`.

Examples:
- [@rules_oci example](example/oci/WORKSPACE.in).
- [@rules_docker example](example/docker/WORKSPACE.in).

- [@rules_oci example](example/oci/WORKSPACE.in)
- [@rules_docker example](example/docker/WORKSPACE.in)

A few notes about the workspace setup:

- It's divided into "steps" based on load statement dependencies. `step1.bzl`
only depends on things declared in `repositories.bzl`, `step2.bzl` depends on
things declared in `step3.bzl`, etc (this pattern is from
things declared in `step1.bzl`, etc (this pattern is from
[tensorflow](https://github.com/tensorflow/tensorflow/tree/master/tensorflow)).
- Your workspace may already have many of the dependencies. Some of the
- Your workspace may already contain some of these dependencies. Also, selected
external workspace names may be differ from yours. Use the example as a study
guide rather than canonical reference.
- The examples are only tested with the older `WORKSPACE`. The rules may not be
compatible with bzlmod yet.
compatible with `bzlmod` yet.

## How it Works

Expand All @@ -43,7 +44,7 @@ graph TD;
numpy{{numpy}}
grpclib{{grpclib}}
subgraph linux_x86_64["linuxx86_64\n"]
subgraph linux_x86_64
image.tar-->image;
image-->app_layer;
image-->site_packages_layer;
Expand Down
4 changes: 3 additions & 1 deletion bazel/rules/docker.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ def py_image(
binary,
base = "@pycross_image_base_container//image",
layers = [],
tags = [],
**kwargs):
"""
py_image is a macro that instantiates an container_image from a py_binary rule
Expand All @@ -15,6 +16,7 @@ def py_image(
binary: target label of the py_binary rule
base: target label of the base image
layers: additional container_layer targets
tags: additional bazel tags for the container_image
**kwargs: additional arguments for the pycross_binary and container_image rules
"""

Expand Down Expand Up @@ -42,6 +44,6 @@ def py_image(
entrypoint = metadata.entrypoint,
cmd = metadata.cmd,
workdir = metadata.workdir,
tags = [metadata.repo_tag],
tags = [metadata.repo_tag] + tags,
**kwargs
)
1 change: 0 additions & 1 deletion example/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ example_test(
example_test(
name = "docker",
srcs = [
"docker/.bazelrc",
"docker/.bazelversion",
"docker/.docker/config.json",
"docker/.dockerconfig.json",
Expand Down
Empty file removed example/docker/.bazelrc
Empty file.
2 changes: 0 additions & 2 deletions example/local.WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ local_repository(
name = "pycross_image",
path = "../pycross_image",
)

# -----------------------------------------
7 changes: 0 additions & 7 deletions src/app/BUILD.bazel

This file was deleted.

1 change: 0 additions & 1 deletion src/app/app.py

This file was deleted.

0 comments on commit e17222a

Please sign in to comment.