blob: 0e919669279b62757f1386df8c5c3de879b18e74 [file] [log] [blame]
Joey Armstrong2c039362024-02-04 18:51:52 -05001# Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors
Matteo Scandolo4747d292019-08-05 11:50:18 -07002#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# bbsim dockerfile
16
17# builder parent
Kent Hagerman60d62302020-03-10 17:02:36 -040018FROM golang:1.13.8-stretch as builder
Matteo Scandolo4747d292019-08-05 11:50:18 -070019
Kent Hagerman60d62302020-03-10 17:02:36 -040020ENV CGO_ENABLED=1
Matteo Scandolo4747d292019-08-05 11:50:18 -070021
Kent Hagerman60d62302020-03-10 17:02:36 -040022WORKDIR /app
Matteo Scandolo4747d292019-08-05 11:50:18 -070023
Matteo Scandolo4747d292019-08-05 11:50:18 -070024# copy and build
25COPY . ./
Kent Hagerman60d62302020-03-10 17:02:36 -040026
27RUN go build -mod vendor \
28 -ldflags "-w -X main.buildTime=$(date +%Y/%m/%d-%H:%M:%S) \
29 -X main.commitHash=$(git log --pretty=format:%H -n 1) \
30 -X main.gitStatus=${GIT_STATUS} \
31 -X main.version=${VERSION}" \
32 ./cmd/bbsim && \
33 go build -mod vendor \
34 -ldflags "-w -X github.com/opencord/bbsim/internal/bbsimctl/config.BuildTime=$(date +%Y/%m/%d-%H:%M:%S) \
35 -X github.com/opencord/bbsim/internal/bbsimctl/config.CommitHash=$(git log --pretty=format:%H -n 1) \
36 -X github.com/opencord/bbsim/internal/bbsimctl/config.GitStatus=${GIT_STATUS} \
37 -X github.com/opencord/bbsim/internal/bbsimctl/config.Version=${VERSION}" \
38 ./cmd/bbsimctl
Matteo Scandolo4747d292019-08-05 11:50:18 -070039
40# runtime parent
Kent Hagerman60d62302020-03-10 17:02:36 -040041FROM ubuntu:18.04
Matteo Scandolo4747d292019-08-05 11:50:18 -070042WORKDIR /app
Kent Hagerman60d62302020-03-10 17:02:36 -040043COPY --from=builder /app/bbsim /app/bbsim
44COPY --from=builder /app/bbsimctl /usr/bin/bbsimctl
Matteo Scandolo90d08f62020-10-29 12:06:55 -070045COPY ./configs/ ./configs/
Matteo Scandolo4747d292019-08-05 11:50:18 -070046RUN chmod a+x /app/bbsim
Matteo Scandolo82c16d02019-09-24 09:34:32 -070047RUN chmod a+x /usr/bin/bbsimctl
Matteo Scandolo91455022020-07-20 15:42:32 -070048RUN bbsimctl completion bash >> "$HOME/.bashrc"
Matteo Scandolo91455022020-07-20 15:42:32 -070049CMD [ "/app/bbsim" ]
Matteo Scandolo90d08f62020-10-29 12:06:55 -070050
51# Label image
52ARG org_label_schema_version=unknown
53ARG org_label_schema_vcs_url=unknown
54ARG org_label_schema_vcs_ref=unknown
55ARG org_label_schema_build_date=unknown
56ARG org_opencord_vcs_commit_date=unknown
57ARG org_opencord_vcs_dirty=unknown
58
59LABEL org.label-schema.schema-version=1.0 \
60 org.label-schema.name=voltha-rw-core \
61 org.label-schema.version=$org_label_schema_version \
62 org.label-schema.vcs-url=$org_label_schema_vcs_url \
63 org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
64 org.label-schema.build-date=$org_label_schema_build_date \
65 org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date \
66 org.opencord.vcs-dirty=$org_opencord_vcs_dirty