docker-file shrink

This commit is contained in:
Hayden 2021-01-19 18:38:13 -09:00
commit 06cfa28b62
4 changed files with 102 additions and 17 deletions

View 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 .

View file

@ -5,28 +5,64 @@ RUN npm install
COPY ./frontend/ .
RUN npm run build
# FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8-slim
FROM mrnr91/uvicorn-gunicorn-fastapi:python3.8
FROM python:3.8-alpine
RUN apk add --no-cache git curl libxml2-dev libxslt-dev libxml2
ENV ENV prod
EXPOSE 80
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/
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
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" ]
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
View file

@ -0,0 +1 @@
docker buildx build .

View file

@ -9,8 +9,7 @@ services:
ports:
- 9090:80
environment:
db_type: sql
db_type: sqlite
# volumes:
# - ./mealie/data/:/app/data