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: on:
push: push:

View file

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

View file

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

View file

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

View file

@ -1,30 +1,34 @@
version: "3.1" version: "3.1"
services: 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: mealie:
container_name: mealie-api
build: build:
context: ./ context: ./
target: production target: production
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: mealie
restart: always restart: always
depends_on:
- "postgres"
ports: ports:
- 9090:80 - 9092:80
environment: environment:
DB_ENGINE: postgres # Optional: 'sqlite', 'postgres' # DB_ENGINE: postgres # Optional: 'sqlite', 'postgres'
POSTGRES_USER: mealie # POSTGRES_USER: mealie
POSTGRES_PASSWORD: mealie # POSTGRES_PASSWORD: mealie
POSTGRES_SERVER: postgres # POSTGRES_SERVER: postgres
POSTGRES_PORT: 5432 # POSTGRES_PORT: 5432
POSTGRES_DB: mealie # POSTGRES_DB: mealie
# WORKERS_PER_CORE: 0.5 # WORKERS_PER_CORE: 0.5
# MAX_WORKERS: 8 # MAX_WORKERS: 8
WEB_CONCURRENCY: 2 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 logging
import sys
from dataclasses import dataclass from dataclasses import dataclass
from functools import lru_cache from functools import lru_cache
@ -33,11 +34,16 @@ def get_logger_config():
logger_file=None, 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( return LoggerConfig(
handlers=[ handlers=[output_file_handler, stdout_handler],
logging.FileHandler(LOGGER_FILE),
logging.Formatter(LOGGER_FORMAT, datefmt=DATE_FORMAT),
],
format="%(levelname)s: %(asctime)s \t%(message)s", format="%(levelname)s: %(asctime)s \t%(message)s",
date_format="%d-%b-%y %H:%M:%S", date_format="%d-%b-%y %H:%M:%S",
logger_file=LOGGER_FILE, logger_file=LOGGER_FILE,