Skip to content

Commit

Permalink
feat(docker): add more docker archs
Browse files Browse the repository at this point in the history
  • Loading branch information
corenting committed Apr 30, 2024
1 parent b9b9049 commit de3b4dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
platform:
- linux/amd64
- linux/arm64
- linux/arm/v7
- linux/ppc64le
steps:
- name: Prepare
run: |
Expand Down
21 changes: 9 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
# Python base (venv and user)
FROM python:3.12-slim AS base
FROM python:3.12 AS base

# Install dependencies and dumb-init
RUN apt-get update && apt-get install -y build-essential curl dumb-init && rm -rf /var/lib/apt/lists/*
# Install dumb-init
RUN apt-get update && apt-get install -y dumb-init

RUN useradd -m eddrit && \
mkdir /app/ && \
chown -R eddrit /app/
USER eddrit

# Install Poetry
ENV PATH="${PATH}:/home/eddrit/.local/bin"
RUN curl -sSL https://install.python-poetry.org | python3 - && \
poetry config virtualenvs.in-project true

# Dependencies
WORKDIR /app/
COPY ./pyproject.toml ./poetry.lock /app/
RUN poetry install --no-interaction --no-root --only main

COPY . /app/
RUN /usr/local/bin/python -m venv .venv
ENV CPPFLAGS=-I/usr/local/include/python3.12/
RUN /app/.venv/bin/pip install .

# Prod image (app and default config)
FROM python:3.12-slim as prod
Expand Down Expand Up @@ -46,4 +42,5 @@ ENV LOG_LEVEL=WARNING

# Expose and run app
EXPOSE 8080
CMD ["dumb-init", "/app/.venv/bin/gunicorn", "eddrit.app:app", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:8080", "--log-file=-"]
ENTRYPOINT ["dumb-init", "--"]
CMD ["/app/.venv/bin/gunicorn", "eddrit.app:app", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:8080", "--log-file=-"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ There are multiple tags:
The following architectures are supported by the Docker image:
- `linux/amd64`
- `linux/arm64`
- `linux/arm/v7`
- `linux/ppc64le`

### Without Docker

Expand Down

0 comments on commit de3b4dc

Please sign in to comment.