blob: 1fe22ad0a1e51e0f7c304c82fd8b17241d0102e1 [file] [log] [blame]
Elia Battistonac8d23f2022-03-14 17:54:56 +01001# 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 Battistonb244bb52022-03-24 15:47:16 +010018FROM --platform=linux/amd64 golang:1.16.3-alpine3.13 AS dev
Elia Battistonac8d23f2022-03-14 17:54:56 +010019
20RUN mkdir -m 777 /.cache /go/pkg
21
Elia Battistonb244bb52022-03-24 15:47:16 +010022RUN 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 Battistonac8d23f2022-03-14 17:54:56 +010024#Install golangci-lint
25RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.2
26
Elia Battistonac8d23f2022-03-14 17:54:56 +010027
Elia Battistonb244bb52022-03-24 15:47:16 +010028ARG LIBYANG_VERSION
29ARG SYSREPO_VERSION
Elia Battistonac8d23f2022-03-14 17:54:56 +010030
Elia Battistonb244bb52022-03-24 15:47:16 +010031#Build libyang
32WORKDIR /
33RUN git clone https://github.com/CESNET/libyang.git
34WORKDIR /libyang
35RUN git checkout $LIBYANG_VERSION && mkdir build
36WORKDIR /libyang/build
37RUN cmake -D CMAKE_BUILD_TYPE:String="Release" .. && \
38 make && \
39 make install
Elia Battistonac8d23f2022-03-14 17:54:56 +010040
Elia Battistonb244bb52022-03-24 15:47:16 +010041#Build sysrepo
42WORKDIR /
43RUN git clone https://github.com/sysrepo/sysrepo.git
44WORKDIR /sysrepo
45RUN git checkout $SYSREPO_VERSION && mkdir build
46WORKDIR /sysrepo/build
47RUN cmake -D CMAKE_BUILD_TYPE:String="Release" .. && \
48 make && \
49 make install
Elia Battistonac8d23f2022-03-14 17:54:56 +010050
51WORKDIR /app
52
53ARG org_label_schema_version=unknown
54ARG org_label_schema_vcs_url=unknown
55ARG org_label_schema_vcs_ref=unknown
56ARG org_label_schema_build_date=unknown
57ARG org_opencord_vcs_commit_date=unknown
58ARG org_opencord_vcs_dirty=unknown
59
60LABEL \
61org.label-schema.schema-version=1.0 \
62org.label-schema.name=voltha-northbound-bbf-adapter \
63org.label-schema.version=$org_label_schema_version \
64org.label-schema.vcs-url=$org_label_schema_vcs_url \
65org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
66org.label-schema.build-date=$org_label_schema_build_date \
67org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date \
68org.opencord.vcs-dirty=$org_opencord_vcs_dirty