refstack/Dockerfile

44 lines
1.6 KiB
Docker

# Copyright (c) 2019 Red Hat, Inc.
# Copyright (c) 2020 OpenStack Foundation
#
# 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.
FROM opendevorg/python-builder as builder
COPY . /tmp/src
RUN /tmp/src/tools/install-js-tools.sh
RUN assemble
RUN cd /tmp/src && yarn install
# Refstack's docs are built and then hosted by refstack UI
RUN python -m venv /tmp/venv \
&& /tmp/venv/bin/pip install beautifulsoup4 docutils \
&& /tmp/venv/bin/python /tmp/src/tools/convert-docs.py -o /tmp/src/refstack-ui/app/components/about/templates /tmp/src/doc/source/*.rst \
&& rm -rf /tmp/venv
FROM opendevorg/python-base as refstack
COPY --from=builder /output/ /output
COPY --from=builder /tmp/src/refstack-ui/app/ /refstack-ui/app
COPY --from=builder /tmp/src/docker/entrypoint.sh /usr/bin/entrypoint
# TODO this should be fixed probably through proper js packaging
RUN rm /refstack-ui/app/assets/lib
COPY --from=builder /tmp/src/node_modules/@bower_components/ /refstack-ui/app/assets/lib
RUN /output/install-from-bindep \
&& rm -rf /output
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["pecan", "serve", "/usr/local/lib/python3.7/site-packages/refstack/api/config.py"]