blob: 2e5dcf5d0d798b4d0a9b72dbb7a80fac0d78364f [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
Zack Williams9a766352019-04-09 18:08:05 -070016FROM xosproject/alpine-grpc-base:0.9.0
17
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
31RUN pip install -e /opt/xos/lib/xos-util \
32 && pip install -e /opt/xos/lib/xos-config \
33 && pip install -e /opt/xos/lib/xos-genx \
34 && pip install -e /opt/xos/lib/xos-kafka \
35 && pip freeze > /var/xos/pip_freeze_xos-core_libs_`date -u +%Y%m%dT%H%M%S` \
36 && mkdir -p /opt/cord_profile /opt/xos-services /opt/xos_libraries \
Zack Williamsffc9b212018-03-22 17:25:33 -070037 && xosgenx --output /opt/xos/core/models --target django.xtarget --dest-extension py \
38 --write-to-file model /opt/xos/core/models/core.xproto \
39 && xosgenx --output /opt/xos/core/models --target django-security.xtarget --dest-file security.py \
40 --write-to-file single /opt/xos/core/models/core.xproto \
41 && xosgenx --output /opt/xos/core/models --target init.xtarget --dest-file __init__.py \
42 --write-to-file single /opt/xos/core/models/core.xproto
Scott Baker21cbf272018-03-30 08:19:07 -070043
44# Set environment variables
45ENV HOME /root
46
47# Define working directory
48WORKDIR /opt/xos
49
50# Label image
Scott Baker21cbf272018-03-30 08:19:07 -070051ARG org_label_schema_version=unknown
52ARG org_label_schema_vcs_url=unknown
53ARG org_label_schema_vcs_ref=unknown
54ARG org_label_schema_build_date=unknown
55ARG org_opencord_vcs_commit_date=unknown
56
Zack Williams9a766352019-04-09 18:08:05 -070057LABEL org.label-schema.schema-version=1.0 \
58 org.label-schema.name=xos-core \
Scott Baker21cbf272018-03-30 08:19:07 -070059 org.label-schema.version=$org_label_schema_version \
60 org.label-schema.vcs-url=$org_label_schema_vcs_url \
61 org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
62 org.label-schema.build-date=$org_label_schema_build_date \
63 org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date