Elia Battiston | ac8d23f | 2022-03-14 17:54:56 +0100 | [diff] [blame] | 1 | # Copyright 2022-present Open Networking Foundation |
| 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 | # Dockerfile with golang and the sysrepo dependencies for voltha-northbound-bff-adapter |
| 16 | # This image is used for testing, static code analysis and building |
| 17 | |
Elia Battiston | b244bb5 | 2022-03-24 15:47:16 +0100 | [diff] [blame^] | 18 | FROM --platform=linux/amd64 golang:1.16.3-alpine3.13 AS dev |
Elia Battiston | ac8d23f | 2022-03-14 17:54:56 +0100 | [diff] [blame] | 19 | |
| 20 | RUN mkdir -m 777 /.cache /go/pkg |
| 21 | |
Elia Battiston | b244bb5 | 2022-03-24 15:47:16 +0100 | [diff] [blame^] | 22 | RUN apk add --no-cache build-base=0.5-r2 pcre2-dev=10.36-r0 git=2.30.2-r0 cmake=3.18.4-r1 |
| 23 | |
Elia Battiston | ac8d23f | 2022-03-14 17:54:56 +0100 | [diff] [blame] | 24 | #Install golangci-lint |
| 25 | RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.2 |
| 26 | |
Elia Battiston | ac8d23f | 2022-03-14 17:54:56 +0100 | [diff] [blame] | 27 | |
Elia Battiston | b244bb5 | 2022-03-24 15:47:16 +0100 | [diff] [blame^] | 28 | ARG LIBYANG_VERSION |
| 29 | ARG SYSREPO_VERSION |
Elia Battiston | ac8d23f | 2022-03-14 17:54:56 +0100 | [diff] [blame] | 30 | |
Elia Battiston | b244bb5 | 2022-03-24 15:47:16 +0100 | [diff] [blame^] | 31 | #Build libyang |
| 32 | WORKDIR / |
| 33 | RUN git clone https://github.com/CESNET/libyang.git |
| 34 | WORKDIR /libyang |
| 35 | RUN git checkout $LIBYANG_VERSION && mkdir build |
| 36 | WORKDIR /libyang/build |
| 37 | RUN cmake -D CMAKE_BUILD_TYPE:String="Release" .. && \ |
| 38 | make && \ |
| 39 | make install |
Elia Battiston | ac8d23f | 2022-03-14 17:54:56 +0100 | [diff] [blame] | 40 | |
Elia Battiston | b244bb5 | 2022-03-24 15:47:16 +0100 | [diff] [blame^] | 41 | #Build sysrepo |
| 42 | WORKDIR / |
| 43 | RUN git clone https://github.com/sysrepo/sysrepo.git |
| 44 | WORKDIR /sysrepo |
| 45 | RUN git checkout $SYSREPO_VERSION && mkdir build |
| 46 | WORKDIR /sysrepo/build |
| 47 | RUN cmake -D CMAKE_BUILD_TYPE:String="Release" .. && \ |
| 48 | make && \ |
| 49 | make install |
Elia Battiston | ac8d23f | 2022-03-14 17:54:56 +0100 | [diff] [blame] | 50 | |
| 51 | WORKDIR /app |
| 52 | |
| 53 | ARG org_label_schema_version=unknown |
| 54 | ARG org_label_schema_vcs_url=unknown |
| 55 | ARG org_label_schema_vcs_ref=unknown |
| 56 | ARG org_label_schema_build_date=unknown |
| 57 | ARG org_opencord_vcs_commit_date=unknown |
| 58 | ARG org_opencord_vcs_dirty=unknown |
| 59 | |
| 60 | LABEL \ |
| 61 | org.label-schema.schema-version=1.0 \ |
| 62 | org.label-schema.name=voltha-northbound-bbf-adapter \ |
| 63 | org.label-schema.version=$org_label_schema_version \ |
| 64 | org.label-schema.vcs-url=$org_label_schema_vcs_url \ |
| 65 | org.label-schema.vcs-ref=$org_label_schema_vcs_ref \ |
| 66 | org.label-schema.build-date=$org_label_schema_build_date \ |
| 67 | org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date \ |
| 68 | org.opencord.vcs-dirty=$org_opencord_vcs_dirty |