Loading .dockerignore +2 −1 Original line number Diff line number Diff line printer/ .vscode/ No newline at end of file .vscode/back/.pytest_cache ui/node_modules .gitlab-ci.yml 0 → 100644 +24 −0 Original line number Diff line number Diff line stages: - deploy variables: GIT_STRATEGY: clone deploy: tags: - muskrat - bare-metal stage: deploy only: - master before_script: - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' - eval $(ssh-agent -s) - echo "$MUSKRAT_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - mkdir -p ~/.ssh - chmod 700 ~/.ssh - echo "$MUSKRAT_SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts script: - ssh $MUSKRAT_DEPLOY_USER@$MUSKRAT_DEPLOY_HOST "cd '/data/live/myfab'; sudo -E ./restart.sh" ci/Dockerfile +15 −6 Original line number Diff line number Diff line FROM ubuntu:18.04 FROM ubuntu:18.04 as base MAINTAINER DVIC (dvic@devinci.fr) FROM python:3.8 as api ADD back /app/back RUN cd /app/back && pip3 install -r requirements.txt FROM node:12 as front ADD ui /app/ui RUN cd /app/ui && yarn && yarn build FROM base as prod RUN apt update RUN apt install -y python3.8 python3-pip mysql-client nodejs nginx curl sudo RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ apt update && apt install -y yarn COPY . /app RUN cd /app/back && pip3 install -r requirements.txt RUN cd /app/ui && yarn && yarn build RUN cp /app/ci/nginx.conf /etc/nginx ADD ci/nginx.conf /etc/nginx RUN nginx -t COPY --from=api /app/back /app/back COPY --from=front /app/ui /app/ui CMD /app/ci/start.sh No newline at end of file docker-compose.yml +3 −0 Original line number Diff line number Diff line Loading @@ -18,12 +18,15 @@ services: db: image: "mysql" restart: always volumes: - ./data:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: db MYSQL_USER: user MYSQL_PASSWORD: password # Get camera inputs rtsp: image: aler9/rtsp-simple-server network_mode: host No newline at end of file restart.sh 0 → 100644 +4 −0 Original line number Diff line number Diff line #!/bin/bash DOCKER_BUILDKIT=1 docker build -t dvic.devinci.fr/server/myfab:latest -f ci/Dockerfile . || exit 1 docker-compose -p myfab down docker-compose -p myfab up -d No newline at end of file Loading
.dockerignore +2 −1 Original line number Diff line number Diff line printer/ .vscode/ No newline at end of file .vscode/back/.pytest_cache ui/node_modules
.gitlab-ci.yml 0 → 100644 +24 −0 Original line number Diff line number Diff line stages: - deploy variables: GIT_STRATEGY: clone deploy: tags: - muskrat - bare-metal stage: deploy only: - master before_script: - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' - eval $(ssh-agent -s) - echo "$MUSKRAT_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - mkdir -p ~/.ssh - chmod 700 ~/.ssh - echo "$MUSKRAT_SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts script: - ssh $MUSKRAT_DEPLOY_USER@$MUSKRAT_DEPLOY_HOST "cd '/data/live/myfab'; sudo -E ./restart.sh"
ci/Dockerfile +15 −6 Original line number Diff line number Diff line FROM ubuntu:18.04 FROM ubuntu:18.04 as base MAINTAINER DVIC (dvic@devinci.fr) FROM python:3.8 as api ADD back /app/back RUN cd /app/back && pip3 install -r requirements.txt FROM node:12 as front ADD ui /app/ui RUN cd /app/ui && yarn && yarn build FROM base as prod RUN apt update RUN apt install -y python3.8 python3-pip mysql-client nodejs nginx curl sudo RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ apt update && apt install -y yarn COPY . /app RUN cd /app/back && pip3 install -r requirements.txt RUN cd /app/ui && yarn && yarn build RUN cp /app/ci/nginx.conf /etc/nginx ADD ci/nginx.conf /etc/nginx RUN nginx -t COPY --from=api /app/back /app/back COPY --from=front /app/ui /app/ui CMD /app/ci/start.sh No newline at end of file
docker-compose.yml +3 −0 Original line number Diff line number Diff line Loading @@ -18,12 +18,15 @@ services: db: image: "mysql" restart: always volumes: - ./data:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: db MYSQL_USER: user MYSQL_PASSWORD: password # Get camera inputs rtsp: image: aler9/rtsp-simple-server network_mode: host No newline at end of file
restart.sh 0 → 100644 +4 −0 Original line number Diff line number Diff line #!/bin/bash DOCKER_BUILDKIT=1 docker build -t dvic.devinci.fr/server/myfab:latest -f ci/Dockerfile . || exit 1 docker-compose -p myfab down docker-compose -p myfab up -d No newline at end of file