blob: 9ec33abf13b4bcce411eb12135606518660e5033 [file] [log] [blame]
Scott Baker21cbf272018-03-30 08:19:07 -07001# Copyright 2017-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
Scott Baker21cbf272018-03-30 08:19:07 -070015# xosproject/xos-core
Scott Baker44476852019-05-02 11:44:26 -070016FROM xosproject/alpine-grpc-base:0.9.1
Zack Williams9a766352019-04-09 18:08:05 -070017
18# Install libraries and python requirements
19COPY requirements.txt /tmp/requirements.txt
Scott Baker6bd238f2019-04-16 16:28:52 -070020RUN apk add --no-cache bash postgresql-dev postgresql-client \
Zack Williams9a766352019-04-09 18:08:05 -070021 && pip install -r /tmp/requirements.txt \
22 && pip freeze > /var/xos/pip_freeze_xos-core_`date -u +%Y%m%dT%H%M%S` \
23 && mkdir -p /opt/xos
Scott Baker21cbf272018-03-30 08:19:07 -070024
25# Install XOS
Zack Williams9a766352019-04-09 18:08:05 -070026COPY VERSION /opt/xos
27COPY xos /opt/xos
28COPY lib /opt/xos/lib
Scott Baker21cbf272018-03-30 08:19:07 -070029
Zack Williams9a766352019-04-09 18:08:05 -070030# Install XOS libraries
Scott Baker89704b12019-05-07 16:42:11 -070031RUN pip install -e /opt/xos/lib/xos-config \
Zack Williams9a766352019-04-09 18:08:05 -070032 && pip install -e /opt/xos/lib/xos-genx \
33 && pip install -e /opt/xos/lib/xos-kafka \
34 && pip freeze > /var/xos/pip_freeze_xos-core_libs_`date -u +%Y%m%dT%H%M%S` \
35 && mkdir -p /opt/cord_profile /opt/xos-services /opt/xos_libraries \
Zack Williamsffc9b212018-03-22 17:25:33 -070036 && xosgenx --output /opt/xos/core/models --target django.xtarget --dest-extension py \
37 --write-to-file model /opt/xos/core/models/core.xproto \
38 && xosgenx --output /opt/xos/core/models --target django-security.xtarget --dest-file security.py \
39 --write-to-file single /opt/xos/core/models/core.xproto \
40 && xosgenx --output /opt/xos/core/models --target init.xtarget --dest-file __init__.py \
41 --write-to-file single /opt/xos/core/models/core.xproto
Scott Baker21cbf272018-03-30 08:19:07 -070042
43# Set environment variables
44ENV HOME /root
45
46# Define working directory
47WORKDIR /opt/xos
48
49# Label image
Scott Baker21cbf272018-03-30 08:19:07 -070050ARG org_label_schema_version=unknown
51ARG org_label_schema_vcs_url=unknown
52ARG org_label_schema_vcs_ref=unknown
53ARG org_label_schema_build_date=unknown
54ARG org_opencord_vcs_commit_date=unknown
55
Scott Baker89704b12019-05-07 16:42:11 -070056# Record git build information
57RUN echo $org_label_schema_vcs_ref > /opt/xos/COMMIT
58
Zack Williams9a766352019-04-09 18:08:05 -070059LABEL org.label-schema.schema-version=1.0 \
60 org.label-schema.name=xos-core \
Scott Baker21cbf272018-03-30 08:19:07 -070061 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