mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
Switch docker to debian
This commit is contained in:
parent
5c41f5dfd7
commit
e8d7b1f177
8 changed files with 69 additions and 76 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
.git/
|
||||||
*/node_modules
|
*/node_modules
|
||||||
*/dist
|
*/dist
|
||||||
*/data/db
|
*/data/db
|
||||||
|
|
|
@ -18,5 +18,4 @@
|
||||||
try_files {path}.html {path} /
|
try_files {path}.html {path} /
|
||||||
file_server
|
file_server
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
66
Dockerfile
66
Dockerfile
|
@ -1,3 +1,4 @@
|
||||||
|
# build
|
||||||
FROM node:lts-alpine as build-stage
|
FROM node:lts-alpine as build-stage
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY ./frontend/package*.json ./
|
COPY ./frontend/package*.json ./
|
||||||
|
@ -5,51 +6,46 @@ RUN npm install
|
||||||
COPY ./frontend/ .
|
COPY ./frontend/ .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM python:3.9-alpine
|
# run
|
||||||
|
FROM python:3.9-buster
|
||||||
|
|
||||||
RUN apk add --no-cache libxml2-dev \
|
|
||||||
libxslt-dev \
|
|
||||||
libxml2 caddy \
|
|
||||||
libffi-dev \
|
|
||||||
python3 \
|
|
||||||
python3-dev \
|
|
||||||
jpeg-dev \
|
|
||||||
lcms2-dev \
|
|
||||||
openjpeg-dev \
|
|
||||||
zlib-dev
|
|
||||||
|
|
||||||
|
|
||||||
ENV PRODUCTION true
|
ENV PRODUCTION true
|
||||||
EXPOSE 80
|
ENV POETRY_VERSION 1.1.6
|
||||||
WORKDIR /app/
|
|
||||||
|
|
||||||
COPY ./pyproject.toml /app/
|
RUN apt-get update && apt-get install -y \
|
||||||
|
apt-transport-https \
|
||||||
|
debian-archive-keyring \
|
||||||
|
debian-keyring \
|
||||||
|
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | apt-key add - \
|
||||||
|
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee -a /etc/apt/sources.list.d/caddy-stable.list \
|
||||||
|
&& apt-get update && apt-get install -y \
|
||||||
|
caddy \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN apk add --update --no-cache --virtual .build-deps \
|
# poetry
|
||||||
curl \
|
RUN pip install --no-cache-dir "poetry==$POETRY_VERSION"
|
||||||
g++ \
|
|
||||||
python3-dev \
|
|
||||||
musl-dev \
|
|
||||||
gcc \
|
|
||||||
build-base && \
|
|
||||||
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
|
|
||||||
cd /usr/local/bin && \
|
|
||||||
ln -s /opt/poetry/bin/poetry && \
|
|
||||||
poetry config virtualenvs.create false && \
|
|
||||||
cd /app/ && poetry install --no-root --no-dev && \
|
|
||||||
apk --purge del .build-deps
|
|
||||||
|
|
||||||
|
# database drivers
|
||||||
|
RUN pip install --no-cache-dir "psycopg2-binary==2.8.6"
|
||||||
|
|
||||||
|
# project dependencies
|
||||||
|
WORKDIR /app
|
||||||
|
COPY pyproject.toml poetry.lock /app/
|
||||||
|
RUN poetry config virtualenvs.create false
|
||||||
|
RUN poetry install --no-root --no-dev --no-interaction --no-ansi
|
||||||
|
|
||||||
|
# project code
|
||||||
COPY ./mealie /app/mealie
|
COPY ./mealie /app/mealie
|
||||||
RUN poetry install --no-dev
|
COPY ./alembic /app
|
||||||
# add database drivers
|
COPY alembic.ini /app
|
||||||
RUN pip install psycopg2-binary
|
|
||||||
|
|
||||||
COPY ./Caddyfile /app
|
COPY ./Caddyfile /app
|
||||||
COPY ./dev/data/templates /app/data/templates
|
COPY ./dev/data/templates /app/data/templates
|
||||||
|
|
||||||
|
# frontend build
|
||||||
COPY --from=build-stage /app/dist /app/dist
|
COPY --from=build-stage /app/dist /app/dist
|
||||||
|
|
||||||
VOLUME [ "/app/data/" ]
|
VOLUME [ "/app/data/" ]
|
||||||
|
|
||||||
RUN chmod +x /app/mealie/run.sh
|
EXPOSE 80
|
||||||
|
|
||||||
CMD /app/mealie/run.sh
|
CMD /app/mealie/run.sh
|
||||||
|
|
|
@ -1,24 +1,23 @@
|
||||||
FROM python:3
|
FROM python:3.9-buster
|
||||||
|
|
||||||
WORKDIR /app/
|
|
||||||
|
|
||||||
ENV PRODUCTION false
|
ENV PRODUCTION false
|
||||||
|
ENV POETRY_VERSION 1.1.6
|
||||||
|
|
||||||
RUN apt-get update -y && \
|
# poetry
|
||||||
apt-get install -y python-pip python-dev
|
RUN pip install --no-cache-dir "poetry==$POETRY_VERSION"
|
||||||
|
|
||||||
# Install Poetry
|
# database drivers
|
||||||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
|
RUN pip install --no-cache-dir "psycopg2-binary==2.8.6"
|
||||||
cd /usr/local/bin && \
|
|
||||||
ln -s /opt/poetry/bin/poetry && \
|
|
||||||
poetry config virtualenvs.create false
|
|
||||||
|
|
||||||
# Copy poetry.lock* in case it doesn't exist in the repo
|
# project dependencies
|
||||||
COPY ./pyproject.toml /app/
|
WORKDIR /app
|
||||||
|
COPY pyproject.toml poetry.lock /app/
|
||||||
|
RUN poetry config virtualenvs.create false
|
||||||
|
RUN poetry install --no-root --no-dev --no-interaction --no-ansi
|
||||||
|
|
||||||
|
# project code
|
||||||
COPY ./mealie /app/mealie
|
COPY ./mealie /app/mealie
|
||||||
|
COPY ./alembic /app/alembic
|
||||||
|
COPY alembic.ini /app
|
||||||
|
|
||||||
RUN poetry install
|
CMD [ "/app/mealie/run.sh", "development" ]
|
||||||
|
|
||||||
RUN chmod +x /app/mealie/run.sh
|
|
||||||
CMD ["/app/mealie/run.sh", "reload"]
|
|
||||||
|
|
|
@ -240,21 +240,20 @@ def upgrade():
|
||||||
op.bulk_insert(site_settings2categories_table, [
|
op.bulk_insert(site_settings2categories_table, [
|
||||||
{
|
{
|
||||||
"sidebar_id": 1,
|
"sidebar_id": 1,
|
||||||
"category_slug", "thanksgiving",
|
"category_slug": "thanksgiving",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sidebar_id": 1,
|
"sidebar_id": 1,
|
||||||
"category_slug", "homechef",
|
"category_slug": "homechef",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sidebar_id": 1,
|
"sidebar_id": 1,
|
||||||
"category_slug", "potatoes",
|
"category_slug": "potatoes",
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
op.bulk_insert(site_theme_table, [
|
op.bulk_insert(theme_colors_table, [
|
||||||
{
|
{
|
||||||
"name": "default",
|
"parent_id": "default",
|
||||||
"colors": {
|
|
||||||
"primary": "#E58325",
|
"primary": "#E58325",
|
||||||
"accent": "#00457A",
|
"accent": "#00457A",
|
||||||
"secondary": "#973542",
|
"secondary": "#973542",
|
||||||
|
@ -263,6 +262,10 @@ def upgrade():
|
||||||
"warning": "#FF4081",
|
"warning": "#FF4081",
|
||||||
"error": "#EF5350",
|
"error": "#EF5350",
|
||||||
},
|
},
|
||||||
|
])
|
||||||
|
op.bulk_insert(site_theme_table, [
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
op.bulk_insert(groups_table, [
|
op.bulk_insert(groups_table, [
|
||||||
|
|
|
@ -27,7 +27,6 @@ services:
|
||||||
- 9921:9000
|
- 9921:9000
|
||||||
environment:
|
environment:
|
||||||
TZ: America/Anchorage # Specify Correct Timezone for Date/Time to line up correctly.
|
TZ: America/Anchorage # Specify Correct Timezone for Date/Time to line up correctly.
|
||||||
DB_URL: sqlite:///mealie.db
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./dev/data:/app/dev/data
|
- ./dev/data:/app/dev/data
|
||||||
- ./mealie:/app/mealie
|
- ./mealie:/app/mealie
|
||||||
|
|
|
@ -8,5 +8,3 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 9090:80
|
- 9090:80
|
||||||
environment:
|
|
||||||
DB_URL: sqlite:///mealie.db
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
# Get Reload Arg `run.sh reload` for dev server
|
# Get Reload Arg `run.sh reload` for dev server
|
||||||
ARG1=${1:-production}
|
ARG1=${1:-production}
|
||||||
|
@ -10,17 +10,15 @@ ARG1=${1:-production}
|
||||||
poetry run alembic upgrade head
|
poetry run alembic upgrade head
|
||||||
poetry run python /app/mealie/services/image/minify.py
|
poetry run python /app/mealie/services/image/minify.py
|
||||||
|
|
||||||
# Migrations
|
|
||||||
# TODO
|
# TODO
|
||||||
# Migrations
|
# Set Port from ENV Variable
|
||||||
# Set Port from ENV Variable
|
|
||||||
|
|
||||||
if [[ "$ARG1" = "reload" ]]
|
if [[ "$ARG1" = "development" ]]
|
||||||
then
|
then
|
||||||
echo "Hot Reload!"
|
echo "Development"
|
||||||
|
|
||||||
# Start API
|
# Start API
|
||||||
uvicorn mealie.app:app --host 0.0.0.0 --port 9000 --reload
|
uvicorn mealie.app:app --host 0.0.0.0 --port 9000
|
||||||
else
|
else
|
||||||
echo "Production"
|
echo "Production"
|
||||||
# Web Server
|
# Web Server
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue