consolidate docker files

This commit is contained in:
hay-kot 2021-04-29 10:16:29 -08:00
commit 5317217570
4 changed files with 136 additions and 0 deletions

54
docker/Dockerfile Normal file
View file

@ -0,0 +1,54 @@
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY ./frontend/package*.json ./
RUN npm install
COPY ./frontend/ .
RUN npm run build
FROM python:3.9-alpine
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
EXPOSE 80
WORKDIR /app/
COPY ./pyproject.toml /app/
RUN apk add --update --no-cache --virtual .build-deps \
curl \
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
COPY ./mealie /app/mealie
RUN poetry install --no-dev
COPY ./Caddyfile /app
COPY ./dev/data/templates /app/data/templates
COPY --from=build-stage /app/dist /app/dist
VOLUME [ "/app/data/" ]
RUN chmod +x /app/mealie/run.sh
CMD /app/mealie/run.sh

24
docker/Dockerfile.dev Normal file
View file

@ -0,0 +1,24 @@
FROM python:3
WORKDIR /app/
ENV PRODUCTION false
RUN apt-get update -y && \
apt-get install -y python-pip python-dev
# Install Poetry
RUN 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
# Copy poetry.lock* in case it doesn't exist in the repo
COPY ./pyproject.toml /app/
COPY ./mealie /app/mealie
RUN poetry install
RUN chmod +x /app/mealie/run.sh
CMD ["/app/mealie/run.sh", "reload"]

View file

@ -0,0 +1,46 @@
# Use root/example as user/password credentials
version: "3.1"
services:
# Vue Frontend
mealie-frontend:
container_name: mealie-frontend
image: mealie-frontend:dev
build:
context: ../frontend
dockerfile: frontend.Dockerfile
restart: always
ports:
- 9920:8080
environment:
VUE_APP_API_BASE_URL: "http://mealie-api:9000"
volumes:
- ../frontend/:/app
- /app/node_modules
# Fast API
mealie-api:
container_name: mealie-api
image: mealie-api:dev
build:
context: ../
dockerfile: ./docker/Dockerfile.dev
restart: always
ports:
- 9921:9000
environment:
db_type: sqlite
TZ: America/Anchorage # Specify Correct Timezone for Date/Time to line up correctly.
volumes:
- ../dev/data:/app/dev/data
- ../mealie:/app/mealie
# Mkdocs
mealie-docs:
container_name: mealie-docs
image: squidfunk/mkdocs-material
restart: always
ports:
- 9922:8000
volumes:
- ../docs:/docs

12
docker/docker-compose.yml Normal file
View file

@ -0,0 +1,12 @@
version: "3.1"
services:
mealie:
build:
context: ../
dockerfile: ./docker/Dockerfile
container_name: mealie
restart: always
ports:
- 9090:80
environment:
db_type: sqlite