mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
docker-file shrink
This commit is contained in:
parent
0c405b5995
commit
06cfa28b62
4 changed files with 102 additions and 17 deletions
49
.github/workflows/dockerbuild.alpine.yml
vendored
Normal file
49
.github/workflows/dockerbuild.alpine.yml
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
name: Docker Build Alpine
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- new-tests
|
||||||
|
|
||||||
|
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 \
|
||||||
|
--tag hkotel/mealie:alpine \
|
||||||
|
--platform linux/amd64,linux/arm/v7,linux/arm64 .
|
66
Dockerfile
66
Dockerfile
|
@ -5,28 +5,64 @@ RUN npm install
|
||||||
COPY ./frontend/ .
|
COPY ./frontend/ .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8-slim
|
FROM python:3.8-alpine
|
||||||
FROM mrnr91/uvicorn-gunicorn-fastapi:python3.8
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN apk add --no-cache git curl libxml2-dev libxslt-dev libxml2
|
||||||
|
ENV ENV prod
|
||||||
|
EXPOSE 80
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apt-get update -y && \
|
|
||||||
apt-get install -y python-pip python-dev git curl python3-dev libxml2-dev libxslt1-dev zlib1g-dev --no-install-recommends && \
|
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
|
||||||
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 ./pyproject.toml /app/
|
COPY ./pyproject.toml /app/
|
||||||
|
|
||||||
|
RUN apk add --update --no-cache --virtual .build-deps \
|
||||||
|
g++ \
|
||||||
|
py-lxml \
|
||||||
|
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
|
COPY ./mealie /app
|
||||||
RUN poetry install --no-root --no-dev
|
|
||||||
COPY --from=build-stage /app/dist /app/dist
|
COPY --from=build-stage /app/dist /app/dist
|
||||||
RUN rm -rf /app/test /app/.temp
|
RUN rm -rf /app/test /app/.temp
|
||||||
|
|
||||||
ENV ENV prod
|
|
||||||
ENV APP_MODULE "app:app"
|
|
||||||
|
|
||||||
VOLUME [ "/app/data" ]
|
|
||||||
|
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"]
|
||||||
|
|
||||||
|
# ---------------------------------- #
|
||||||
|
# Old Docker File
|
||||||
|
# ---------------------------------- #
|
||||||
|
|
||||||
|
# FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8-slim
|
||||||
|
# FROM mrnr91/uvicorn-gunicorn-fastapi:python3.8
|
||||||
|
|
||||||
|
|
||||||
|
# WORKDIR /app
|
||||||
|
|
||||||
|
# RUN apt-get update -y && \
|
||||||
|
# apt-get install -y python-pip python-dev git curl python3-dev libxml2-dev libxslt1-dev zlib1g-dev --no-install-recommends && \
|
||||||
|
# rm -rf /var/lib/apt/lists/* && \
|
||||||
|
# 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 ./pyproject.toml /app/
|
||||||
|
|
||||||
|
# COPY ./mealie /app
|
||||||
|
# RUN poetry install --no-root --no-dev
|
||||||
|
# COPY --from=build-stage /app/dist /app/dist
|
||||||
|
# RUN rm -rf /app/test /app/.temp
|
||||||
|
|
||||||
|
# ENV ENV prod
|
||||||
|
# ENV APP_MODULE "app:app"
|
||||||
|
|
||||||
|
# VOLUME [ "/app/data" ]
|
||||||
|
|
1
dev/scripts/buildx.sh
Normal file
1
dev/scripts/buildx.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
docker buildx build .
|
|
@ -9,8 +9,7 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- 9090:80
|
- 9090:80
|
||||||
environment:
|
environment:
|
||||||
db_type: sql
|
db_type: sqlite
|
||||||
|
|
||||||
# volumes:
|
# volumes:
|
||||||
# - ./mealie/data/:/app/data
|
# - ./mealie/data/:/app/data
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue