*: bazelify
diff --git a/bzl/rules.bzl b/bzl/rules.bzl
new file mode 100644
index 0000000..996a07b
--- /dev/null
+++ b/bzl/rules.bzl
@@ -0,0 +1,21 @@
+def _copy_go_binary_impl(ctx):
+    output = ctx.actions.declare_file(ctx.label.name)
+    for f in ctx.attr.src.files:
+        # go_binary rules have two outputs, a library and the binary itself.
+        # The following is a horrible hack to avoid copying the library.
+        if f.path.endswith(".a"):
+            continue
+        ctx.action(
+            inputs=[f],
+            outputs=[output],
+            mnemonic="CopyGoBinary",
+            command="mkdir -p %s && cp %s %s" % (output.dirname, f.path, output.path))
+        return [DefaultInfo(executable=output)]
+
+copy_go_binary = rule(
+    implementation=_copy_go_binary_impl,
+    attrs={
+        "src": attr.label(mandatory=True, allow_files=True),
+    },
+    executable=True,
+)