Daniele Moro | c3d410a | 2020-12-10 12:09:14 +0100 | [diff] [blame] | 1 | # Copyright 2020-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 | |
| 16 | # With this dockerfile you can build a ONOS Docker container from the output of |
| 17 | # a local build with Bazel. |
| 18 | # The container must be build from the bazel-bin folder (due to symlink and |
| 19 | # COPY command incompatibilities). |
| 20 | # e.g. docker build -t onosproject/onos:latest -f $ONOS_ROOT/tools/dev/Dockerfile-bazel $ONOS_ROOT/bazel-bin |
| 21 | |
| 22 | ARG TAG=11.0.8-11.41.23 |
| 23 | ARG JAVA_PATH=/usr/lib/jvm/zulu11-ca-amd64 |
| 24 | |
| 25 | # Firts stage to copy and untar ONOS archive inside the container. |
| 26 | FROM bitnami/minideb:jessie as untar |
| 27 | |
| 28 | COPY ./onos.tar.gz / |
| 29 | RUN mkdir /output/ |
| 30 | RUN tar -xf /onos.tar.gz -C /output/ --strip-components=1 |
| 31 | |
| 32 | # Second and final stage is the runtime environment. |
| 33 | FROM azul/zulu-openjdk:${TAG} |
| 34 | |
| 35 | LABEL org.label-schema.name="ONOS" \ |
| 36 | org.label-schema.description="SDN Controller" \ |
| 37 | org.label-schema.usage="http://wiki.onosproject.org" \ |
| 38 | org.label-schema.url="http://onosproject.org" \ |
| 39 | org.label-scheme.vendor="Open Networking Foundation" \ |
| 40 | org.label-schema.schema-version="1.0" \ |
| 41 | maintainer="onos-dev@onosproject.org" |
| 42 | |
| 43 | RUN apt-get update && apt-get install -y curl && \ |
| 44 | rm -rf /var/lib/apt/lists/* |
| 45 | |
| 46 | # Copy ONOS in /root/onos |
| 47 | COPY --from=untar /output /root/onos |
| 48 | |
| 49 | WORKDIR /root/onos |
| 50 | |
| 51 | # Set JAVA_HOME (by default not exported by zulu images) |
| 52 | ARG JAVA_PATH |
| 53 | ENV JAVA_HOME ${JAVA_PATH} |
| 54 | |
| 55 | # Ports |
| 56 | # 6653 - OpenFlow |
| 57 | # 6640 - OVSDB |
| 58 | # 8181 - GUI |
| 59 | # 8101 - ONOS CLI |
| 60 | # 9876 - ONOS intra-cluster communication |
| 61 | EXPOSE 6653 6640 8181 8101 9876 |
| 62 | |
| 63 | # Run ONOS |
| 64 | ENTRYPOINT ["./bin/onos-service"] |
| 65 | CMD ["server"] |