Joey Armstrong | 2c03936 | 2024-02-04 18:51:52 -0500 | [diff] [blame] | 1 | # Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 2 | # |
| 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 Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 18 | FROM golang:1.13.8-stretch as builder |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 19 | |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 20 | ENV CGO_ENABLED=1 |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 21 | |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 22 | WORKDIR /app |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 23 | |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 24 | # copy and build |
| 25 | COPY . ./ |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 26 | |
| 27 | RUN 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 Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 39 | |
| 40 | # runtime parent |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 41 | FROM ubuntu:18.04 |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 42 | WORKDIR /app |
Kent Hagerman | 60d6230 | 2020-03-10 17:02:36 -0400 | [diff] [blame] | 43 | COPY --from=builder /app/bbsim /app/bbsim |
| 44 | COPY --from=builder /app/bbsimctl /usr/bin/bbsimctl |
Matteo Scandolo | 90d08f6 | 2020-10-29 12:06:55 -0700 | [diff] [blame] | 45 | COPY ./configs/ ./configs/ |
Matteo Scandolo | 4747d29 | 2019-08-05 11:50:18 -0700 | [diff] [blame] | 46 | RUN chmod a+x /app/bbsim |
Matteo Scandolo | 82c16d0 | 2019-09-24 09:34:32 -0700 | [diff] [blame] | 47 | RUN chmod a+x /usr/bin/bbsimctl |
Matteo Scandolo | 9145502 | 2020-07-20 15:42:32 -0700 | [diff] [blame] | 48 | RUN bbsimctl completion bash >> "$HOME/.bashrc" |
Matteo Scandolo | 9145502 | 2020-07-20 15:42:32 -0700 | [diff] [blame] | 49 | CMD [ "/app/bbsim" ] |
Matteo Scandolo | 90d08f6 | 2020-10-29 12:06:55 -0700 | [diff] [blame] | 50 | |
| 51 | # Label image |
| 52 | ARG org_label_schema_version=unknown |
| 53 | ARG org_label_schema_vcs_url=unknown |
| 54 | ARG org_label_schema_vcs_ref=unknown |
| 55 | ARG org_label_schema_build_date=unknown |
| 56 | ARG org_opencord_vcs_commit_date=unknown |
| 57 | ARG org_opencord_vcs_dirty=unknown |
| 58 | |
| 59 | LABEL 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 |