feat: Add make build
1. Add dockerfile 2. Modify gunicorn config Change-Id: I99d233908b3f21e5e0a4cd739ee7702839a8fb46
This commit is contained in:
parent
4fa4083d57
commit
ee84ba0b8f
|
@ -58,13 +58,13 @@ docs/_build/
|
|||
.python-version
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
**/.env
|
||||
**/.venv
|
||||
**/env/
|
||||
**/venv/
|
||||
**/ENV/
|
||||
**/env.bak/
|
||||
**/venv.bak/
|
||||
|
||||
# Development
|
||||
.vscode/
|
||||
|
@ -76,8 +76,5 @@ tmp/
|
|||
.idea
|
||||
|
||||
# Remove build context
|
||||
.git
|
||||
.gitreview
|
||||
docs
|
||||
tests
|
||||
requirements.txt
|
||||
**/.git
|
||||
**/tmp
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
# Setp1. Build static
|
||||
FROM node:erbium AS builder
|
||||
|
||||
COPY ./libs/skyline-console /skyline-console/
|
||||
|
||||
RUN cd /skyline-console \
|
||||
&& yarn install \
|
||||
&& rm -rf /skyline-console/skyline_console/static \
|
||||
&& yarn run build
|
||||
|
||||
|
||||
# Setp2. Build image
|
||||
FROM ubuntu:20.04
|
||||
|
||||
ARG GIT_BRANCH
|
||||
ARG GIT_COMMIT
|
||||
ARG RELEASE_VERSION
|
||||
|
||||
LABEL skyline.build_branch=${GIT_BRANCH}\
|
||||
skyline.build_commit=${GIT_COMMIT} \
|
||||
skyline.release_version=${RELEASE_VERSION}
|
||||
|
||||
ENV LANG C.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
|
||||
COPY ./ /skyline/
|
||||
COPY --from=builder /skyline-console/skyline_console/static /skyline/libs/skyline-console/skyline_console/static
|
||||
COPY ./container/start_service.sh /usr/local/bin/start_service.sh
|
||||
COPY ./etc/skyline.yaml.sample /etc/skyline/skyline.yaml
|
||||
COPY ./etc/gunicorn.py /etc/skyline/gunicorn.py
|
||||
|
||||
RUN export LANG=C.UTF-8 \
|
||||
&& apt-get update -y && apt-get install -y --no-install-recommends apt-utils \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
gcc make nginx traceroute lsof iputils-ping vim git wget curl locales-all ssl-cert \
|
||||
python3 python3-pip python3-dev python3-venv \
|
||||
&& rm -rf /usr/bin/python /usr/bin/pip \
|
||||
&& ln -s /usr/bin/python3 /usr/bin/python \
|
||||
&& ln -s /usr/bin/pip3 /usr/bin/pip \
|
||||
&& pip install poetry \
|
||||
&& poetry config virtualenvs.create false \
|
||||
&& mkdir -p /etc/skyline /var/log/skyline/ /var/lib/skyline \
|
||||
&& cd /skyline \
|
||||
&& poetry install \
|
||||
&& apt-get clean \
|
||||
&& rm -rf ~/.cache/pip
|
||||
|
||||
EXPOSE 443
|
||||
|
||||
CMD ["start_service.sh"]
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
# kolla_set_configs
|
||||
echo "/usr/local/bin/gunicorn -c /etc/skyline/gunicorn.py skyline_apiserver.main:app" >/run_command
|
||||
|
||||
mapfile -t CMD < <(tail /run_command | xargs -n 1)
|
||||
|
||||
# kolla_extend_start
|
||||
nginx-generator -o /etc/nginx/nginx.conf
|
||||
nginx
|
||||
|
||||
echo "Running command: ${CMD[*]}"
|
||||
exec "${CMD[@]}"
|
|
@ -1,8 +1,12 @@
|
|||
bind = ['0.0.0.0:28000']
|
||||
workers = 2
|
||||
import multiprocessing
|
||||
|
||||
bind = "unix:/var/lib/skyline/skyline.sock"
|
||||
workers = (1 + multiprocessing.cpu_count()) // 2
|
||||
worker_class = "uvicorn.workers.UvicornWorker"
|
||||
timeout = 3600
|
||||
keepalive = 5
|
||||
reuse_port = True
|
||||
proc_name = "skyline-apiserver"
|
||||
proc_name = "skyline"
|
||||
log_level = "debug"
|
||||
accesslog = "/var/log/skyline/access.log"
|
||||
errorlog = "/var/log/skyline/error.log"
|
||||
|
|
Loading…
Reference in New Issue