- readme
- functional code
This commit is contained in:
1 parent
63cfd936b5
commit
1e44a28919
7 files changed
+73
-14
No files matched your search
+36
-9
@@ -1,17 +1,44 @@
|
||||
ARG BUILD_FROM
|
||||
# ================
|
||||
# Python Build Stage
|
||||
# ================
|
||||
FROM python:3.9 as pybuilder
|
||||
|
||||
WORKDIR /python
|
||||
|
||||
COPY api/setup.py /python/setup.py
|
||||
RUN python -m venv /python/venv
|
||||
RUN /python/venv/bin/pip install --use-feature=in-tree-build /python/
|
||||
|
||||
# ================
|
||||
# Web Build Stage
|
||||
# ================
|
||||
FROM node:16.13.0-alpine as webbuilder
|
||||
|
||||
WORKDIR /web
|
||||
COPY webapp/ /web
|
||||
RUN npm install
|
||||
RUN yarn build
|
||||
|
||||
# ================
|
||||
# Main Image
|
||||
# ================
|
||||
FROM $BUILD_FROM
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
# Install requirements for add-on
|
||||
RUN apk add --no-cache python3
|
||||
|
||||
# Python 3 HTTP Server serves the current working dir
|
||||
# So let's set it to our add-on persistent data directory.
|
||||
WORKDIR /data
|
||||
RUN apk add gcompat python3
|
||||
RUN ln -s $(which python3) /usr/local/bin/python
|
||||
|
||||
# Copy data for add-on
|
||||
COPY run.sh /
|
||||
RUN chmod a+x /run.sh
|
||||
COPY --from=pybuilder /python/venv /data/venv
|
||||
COPY --from=webbuilder /web/build /data/web
|
||||
|
||||
CMD [ "/run.sh" ]
|
||||
COPY api/src /data/src
|
||||
|
||||
|
||||
ENV HASSIO_TOKEN ""
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD [ "/data/venv/bin/python", "-m", "uvicorn", "src.app:app" ]
|
||||
Reference in new issue
Block a user