Lint and update dockerfile for deploying

This commit is contained in:
2021-01-11 11:35:59 +05:30
parent 748fb37511
commit f2e330df61
17 changed files with 104 additions and 112 deletions

View File

@ -1,14 +1,14 @@
FROM node:latest AS builder
ADD https://git.tanshu.com/api/v1/repos/tanshu/barker/tags /tags.json
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 --legacy-peer-deps && /app/bookie/node_modules/.bin/ng build --prod
ADD https://git.tanshu.com/api/v1/repos/tanshu/luthor/branches/main /main.json
RUN git clone --single-branch --depth 1 --branch latest https://git.tanshu.com/tanshu/luthor.git /app
WORKDIR /app/otis
RUN npm install --unsafe-perm --legacy-peer-deps && /app/otis/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/luthor /app
COPY --from=builder /app/frontend /app/frontend
RUN apt-get update && \

View File

@ -2,16 +2,12 @@ HOST=0.0.0.0
PORT=80
LOG_LEVEL=WARN
DEBUG=false
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/petty
MODULE_NAME=barker.main
PROJECT_NAME=barker
REDIS_HOST=redis
REDIS_PORT=6379
SECRET_KEY=611f9393e58f85521d16d9497bfd847ced70f2b99e12a9c6af40b7bd05cc7b1d
MIDDLEWARE_SECRET_KEY=c4afceca1a
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/luthor
MODULE_NAME=luthor.main
PROJECT_NAME=luthor
SECRET_KEY=0500a11310479deb2e3a729b59ee65c5f832da30d86624ec88619315054bea92
MIDDLEWARE_SECRET_KEY=70282004a7
ALGORITHM=HS256
JWT_TOKEN_EXPIRE_MINUTES=30
NEW_DAY_OFFSET_MINUTES=420
TIMEZONE_OFFSET_MINUTES=330
ALEMBIC_LOG_LEVEL=INFO
ALEMBIC_SQLALCHEMY_LOG_LEVEL=WARN

View File

@ -11,9 +11,9 @@
- name: Copy dockerfile
synchronize: src=app dest=/tmp
- name: Build barker image
- name: Build luthor image
docker_image:
name: barker:latest
name: luthor:latest
build:
path: /tmp/app/
dockerfile: /tmp/app/Dockerfile
@ -21,47 +21,25 @@
state: present
source: build
- name: Build barker worker image
docker_image:
name: barker-worker:latest
build:
path: /tmp/app/
dockerfile: /tmp/app/worker.Dockerfile
pull: yes
state: present
source: build
- name: Upload the .env file
template:
src: "files/.env"
dest: "/var/lib/{{ host_directory }}/.env"
- name: Create barker container
- name: Create luthor container
docker_container:
name: "{{ host_directory }}"
image: barker:latest
image: luthor:latest
state: started
restart_policy: "unless-stopped"
env_file: "/var/lib/{{ host_directory }}/.env"
links:
- "postgres:db"
- "redis:redis"
published_ports:
- "127.0.0.1:{{ host_port }}:80"
volumes:
- "/var/lib/{{ host_directory }}/frontend:/frontend"
- name: Create barker worker container
docker_container:
name: "{{ host_directory }}-worker"
image: barker-worker:latest
state: started
restart_policy: "unless-stopped"
env_file: "/var/lib/{{ host_directory }}/.env"
links:
- "redis:redis"
- name: Check if Nginx conf file exists
stat: path="/etc/nginx/sites-available/{{ http_conf }}"
register: status