add nightly CI/CD

This commit is contained in:
hay-kot 2021-08-07 20:22:22 -08:00
parent 886d1b7a50
commit ff2b681980
9 changed files with 146 additions and 35 deletions

View file

@ -0,0 +1,49 @@
name: Backend - Nightly Build
on:
push:
branches:
- mealie-next
jobs:
build:
runs-on: ubuntu-latest
steps:
#
# Checkout
#
- name: checkout code
uses: actions/checkout@v2
#
# Setup QEMU
#
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
#
# Setup Buildx
#
- name: install buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
#
# Login to Docker Hub
#
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# Build
#
- name: build the image
run: |
docker build --push --no-cache \
--tag hkotel/mealie:api-nightly \
--platform linux/amd64,linux/arm64 .

View file

@ -0,0 +1,50 @@
name: Frontend - Nightly Build
on:
push:
branches:
- mealie-next
jobs:
build:
runs-on: ubuntu-latest
steps:
#
# Checkout
#
- name: checkout code
uses: actions/checkout@v2
#
# Setup QEMU
#
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
#
# Setup Buildx
#
- name: install buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
#
# Login to Docker Hub
#
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# Build
#
- name: build the image
working-directory: "frontend"
run: |
docker build --push --no-cache \
--tag hkotel/mealie:frontend-nightly \
--platform linux/amd64,linux/arm64 .

View file

@ -1,4 +1,4 @@
name: ci
name: Frontend Lint
on:
push:

View file

@ -22,7 +22,7 @@
handle @proxied {
uri strip_suffix /
reverse_proxy http://127.0.0.1:9000
reverse_proxy http://mealie-api
}
handle {

View file

@ -1,12 +1,12 @@
###############################################
# Frontend Builder Image
###############################################
FROM node:lts-alpine as frontend-build
WORKDIR /app
COPY ./frontend/package*.json ./
RUN npm install
COPY ./frontend/ .
RUN npm run build
# # Frontend Builder Image
# ###############################################
# FROM node:lts-alpine as frontend-build
# WORKDIR /app
# COPY ./frontend/package*.json ./
# RUN npm install
# COPY ./frontend/ .
# RUN npm run build
###############################################
# Base Image
@ -125,7 +125,7 @@ RUN . $VENV_PATH/bin/activate && poetry install -E pgsql --no-dev
WORKDIR /
# copy frontend
COPY --from=frontend-build /app/dist $MEALIE_HOME/dist
# COPY --from=frontend-build /app/dist $MEALIE_HOME/dist
COPY ./dev/data/templates $MEALIE_HOME/data/templates
COPY ./Caddyfile $MEALIE_HOME

View file

@ -7,12 +7,14 @@ services:
image: mealie-frontend:dev
build:
context: ./frontend
dockerfile: frontend.Dockerfile
dockerfile: Dockerfile.frontend
restart: always
ports:
- 9920:8080
environment:
VUE_APP_API_BASE_URL: "http://mealie-api:9000"
- GLOBAL_MIDDLEWARE=null
- BASE_URL=""
- ALLOW_SIGNUP=true
volumes:
- ./frontend/:/app
- /app/node_modules

View file

@ -1,30 +1,34 @@
version: "3.1"
services:
mealie-frontend:
container_name: mealie-frontend
image: mealie-frontend:dev
build:
context: ./frontend
dockerfile: Dockerfile
restart: always
ports:
- 9091:3000
environment:
- GLOBAL_MIDDLEWARE=null
- BASE_URL=""
- ALLOW_SIGNUP=true
mealie:
container_name: mealie-api
build:
context: ./
target: production
dockerfile: Dockerfile
container_name: mealie
restart: always
depends_on:
- "postgres"
ports:
- 9090:80
- 9092:80
environment:
DB_ENGINE: postgres # Optional: 'sqlite', 'postgres'
POSTGRES_USER: mealie
POSTGRES_PASSWORD: mealie
POSTGRES_SERVER: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: mealie
# DB_ENGINE: postgres # Optional: 'sqlite', 'postgres'
# POSTGRES_USER: mealie
# POSTGRES_PASSWORD: mealie
# POSTGRES_SERVER: postgres
# POSTGRES_PORT: 5432
# POSTGRES_DB: mealie
# WORKERS_PER_CORE: 0.5
# MAX_WORKERS: 8
WEB_CONCURRENCY: 2
postgres:
container_name: postgres
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: mealie
POSTGRES_USER: mealie

View file

@ -1,4 +1,5 @@
import logging
import sys
from dataclasses import dataclass
from functools import lru_cache
@ -33,11 +34,16 @@ def get_logger_config():
logger_file=None,
)
output_file_handler = logging.FileHandler(LOGGER_FILE)
handler_format = logging.Formatter(LOGGER_FORMAT, datefmt=DATE_FORMAT)
output_file_handler.setFormatter(handler_format)
# Stdout
stdout_handler = logging.StreamHandler(sys.stdout)
stdout_handler.setFormatter(handler_format)
return LoggerConfig(
handlers=[
logging.FileHandler(LOGGER_FILE),
logging.Formatter(LOGGER_FORMAT, datefmt=DATE_FORMAT),
],
handlers=[output_file_handler, stdout_handler],
format="%(levelname)s: %(asctime)s \t%(message)s",
date_format="%d-%b-%y %H:%M:%S",
logger_file=LOGGER_FILE,