New:
Fastapi Brewman Fastapi Barker
This commit is contained in:
32
barker/app/Dockerfile
Normal file
32
barker/app/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
||||
FROM node:latest AS builder
|
||||
RUN git clone --single-branch --depth 1 --branch latest https://git.tanshu.com/tanshu/barker.git /app
|
||||
WORKDIR /app/bookie
|
||||
RUN npm install --unsafe-perm && /app/bookie/node_modules/.bin/ng build --prod
|
||||
|
||||
|
||||
FROM python:latest
|
||||
LABEL maintainer="Amritanshu <docker@tanshu.com>"
|
||||
COPY --from=builder /app/barker /app
|
||||
COPY --from=builder /app/frontend /app/frontend
|
||||
WORKDIR /app
|
||||
|
||||
# Install Poetry
|
||||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
|
||||
cd /usr/local/bin && \
|
||||
ln -s /opt/poetry/bin/poetry && \
|
||||
poetry config virtualenvs.create false
|
||||
|
||||
# Allow installing dev dependencies to run tests
|
||||
ARG INSTALL_DEV=false
|
||||
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi"
|
||||
|
||||
ENV PYTHONPATH=/app
|
||||
EXPOSE 80
|
||||
VOLUME /frontend
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod 777 /usr/local/bin/docker-entrypoint.sh \
|
||||
&& ln -s /usr/local/bin/docker-entrypoint.sh /
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["python", "-m", "barker"]
|
||||
25
barker/app/backend.dockerfile
Normal file
25
barker/app/backend.dockerfile
Normal file
@ -0,0 +1,25 @@
|
||||
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7
|
||||
|
||||
WORKDIR /app/
|
||||
|
||||
# Install Poetry
|
||||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
|
||||
cd /usr/local/bin && \
|
||||
ln -s /opt/poetry/bin/poetry && \
|
||||
poetry config virtualenvs.create false
|
||||
|
||||
# Copy poetry.lock* in case it doesn't exist in the repo
|
||||
COPY ./app/pyproject.toml ./app/poetry.lock* /app/
|
||||
|
||||
# Allow installing dev dependencies to run tests
|
||||
ARG INSTALL_DEV=false
|
||||
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi"
|
||||
|
||||
# For development, Jupyter remote kernel, Hydrogen
|
||||
# Using inside the container:
|
||||
# jupyter lab --ip=0.0.0.0 --allow-root --NotebookApp.custom_display_url=http://127.0.0.1:8888
|
||||
ARG INSTALL_JUPYTER=false
|
||||
RUN bash -c "if [ $INSTALL_JUPYTER == 'true' ] ; then pip install jupyterlab ; fi"
|
||||
|
||||
COPY ./app /app
|
||||
ENV PYTHONPATH=/app
|
||||
35
barker/app/celeryworker.dockerfile
Normal file
35
barker/app/celeryworker.dockerfile
Normal file
@ -0,0 +1,35 @@
|
||||
FROM python:3.7
|
||||
|
||||
WORKDIR /app/
|
||||
|
||||
# Install Poetry
|
||||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
|
||||
cd /usr/local/bin && \
|
||||
ln -s /opt/poetry/bin/poetry && \
|
||||
poetry config virtualenvs.create false
|
||||
|
||||
# Copy poetry.lock* in case it doesn't exist in the repo
|
||||
COPY ./app/pyproject.toml ./app/poetry.lock* /app/
|
||||
|
||||
# Allow installing dev dependencies to run tests
|
||||
ARG INSTALL_DEV=false
|
||||
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi"
|
||||
|
||||
# For development, Jupyter remote kernel, Hydrogen
|
||||
# Using inside the container:
|
||||
# jupyter lab --ip=0.0.0.0 --allow-root --NotebookApp.custom_display_url=http://127.0.0.1:8888
|
||||
ARG INSTALL_JUPYTER=false
|
||||
RUN bash -c "if [ $INSTALL_JUPYTER == 'true' ] ; then pip install jupyterlab ; fi"
|
||||
|
||||
ENV C_FORCE_ROOT=1
|
||||
|
||||
COPY ./app /app
|
||||
WORKDIR /app
|
||||
|
||||
ENV PYTHONPATH=/app
|
||||
|
||||
COPY ./app/worker-start.sh /worker-start.sh
|
||||
|
||||
RUN chmod +x /worker-start.sh
|
||||
|
||||
CMD ["bash", "/worker-start.sh"]
|
||||
6
barker/app/docker-entrypoint.sh
Normal file
6
barker/app/docker-entrypoint.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cp /app/frontend/* /frontend
|
||||
|
||||
exec "$@"
|
||||
24
barker/app/worker.Dockerfile
Normal file
24
barker/app/worker.Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
FROM python:latest
|
||||
LABEL maintainer="Amritanshu <docker@tanshu.com>"
|
||||
RUN git clone --single-branch --depth 1 --branch latest https://git.tanshu.com/tanshu/barker.git /repo
|
||||
RUN mkdir /app && mv /repo/barker/* /app
|
||||
WORKDIR /app
|
||||
|
||||
# Install Poetry
|
||||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
|
||||
cd /usr/local/bin && \
|
||||
ln -s /opt/poetry/bin/poetry && \
|
||||
poetry config virtualenvs.create false
|
||||
|
||||
# Allow installing dev dependencies to run tests
|
||||
ARG INSTALL_DEV=false
|
||||
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi"
|
||||
|
||||
ENV C_FORCE_ROOT=1
|
||||
ENV PYTHONPATH=/app
|
||||
|
||||
RUN mv /app/worker-start.sh /usr/local/bin/ \
|
||||
&& chmod 777 /usr/local/bin/worker-start.sh \
|
||||
&& ln -s /usr/local/bin/worker-start.sh /
|
||||
|
||||
CMD ["bash", "worker-start.sh"]
|
||||
Reference in New Issue
Block a user