| # ----------------------------------------------------------------------- |
| # Copyright 2017-2024 Open Networking Foundation Contributors |
| # |
| # 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. |
| # ----------------------------------------------------------------------- |
| # SPDX-FileCopyrightText: 2017-2024 Open Networking Foundation Contributors |
| # SPDX-License-Identifier: Apache-2.0 |
| # ----------------------------------------------------------------------- |
| |
| FROM --platform=linux/amd64 golang:1.16.3-alpine3.13 AS dev |
| |
| RUN adduser -h /home/voltha-go-controller -s /bin/bash -D voltha-go-controller |
| # Install required packages |
| RUN apk add --no-cache build-base=0.5-r3 |
| |
| #adding git |
| #RUN apk add --no-cache bash=5.1.16-r0 |
| |
| #chnaging the working dir to tmp |
| WORKDIR /tmp |
| ENV LD_LIBRARY_PATH=/usr/local/lib |
| |
| # Set the working directory |
| WORKDIR /go/src/voltha-go-controller |
| # Copy required files |
| COPY database ./database |
| COPY vendor ./vendor |
| COPY voltha-go-controller ./voltha-go-controller |
| COPY internal ./internal |
| COPY log ./log |
| COPY infra ./infra |
| COPY go.mod ./ |
| COPY go.sum ./ |
| |
| |
| WORKDIR /go/src/voltha-go-controller/voltha-go-controller |
| #RUN go build |
| #Set CGO_ENABLED flag to 0 to avoid DNS issue in alpine release |
| RUN CGO_ENABLED=0 go build -a -v -o /app/voltha-go-controller |
| |
| WORKDIR /go/src/voltha-go-controller/voltha-go-controller/cli |
| RUN CGO_ENABLED=0 go build -a -v -o /app/vgcctl |
| |
| FROM --platform=linux/amd64 golang:1.16.3-alpine3.13 AS prod |
| |
| RUN adduser -h /home/voltha-go-controller -s /bin/bash -D voltha-go-controller |
| |
| RUN apk add --no-cache bash=5.1.16-r0 |
| # Set the working directory |
| WORKDIR /app |
| |
| # Copy required files |
| COPY --from=dev /app/voltha-go-controller /app |
| COPY --from=dev /app/vgcctl /app |
| |
| RUN chown -R voltha-go-controller.voltha-go-controller /app/voltha-go-controller /usr/local/bin/ |
| RUN apk add --no-cache openssh=8.4_p1-r4 |
| |
| RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/init.d/sshd |
| ENV NOTVISIBLE "in users profile" |
| RUN echo "export VISIBLE=now" >> /etc/profile |
| |
| EXPOSE 22 |
| |
| # [EOF] |