# Copyright 2017 Istio Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
#
load("@rules_pkg//:pkg.bzl", "pkg_deb", "pkg_tar")

# TODO: decide the proper location for binaries and configs and update the file.
# Current layout for binaries matches 0.1 and docker images.

pkg_tar(
    name = "istio-conf",
    srcs = [
        "envoy.json",
        "sidecar.env",
    ],
    mode = "0755",
    package_dir = "/var/lib/istio/envoy",
)

pkg_tar(
    name = "debian-data",
    extension = "tar.gz",
    tags = ["manual"],
    deps = [
        ":istio-conf",
        "//src/envoy:envoy_tar",
    ],
)

pkg_deb(
    name = "istio-proxy",
    architecture = "amd64",
    built_using = "bazel",
    conffiles_file = "conffiles",
    data = ":debian-data",
    description_file = "description",
    homepage = "http://istio.io",
    maintainer = "The Istio Authors <istio-dev@googlegroups.com>",
    package = "istio-proxy",
    postinst = "postinst.sh",
    tags = ["manual"],
    version_file = "//:deb_version",
)
