Skip to content

Docker

Important

Currently there is no published image - this will happen once maker-hub is officially released.

Requirements

  1. Docker Desktop installed on the local machine (https://www.docker.com/products/docker-desktop).
  2. clone this repo and make install dependencies (or make update if you already have a clone of the repo).
  3. docker compose up to build and run. will be available on http://localhost:8080/ try docker compose build --no-cache first if it is caching the local build
  4. docker compose down to stop.

Note

no volume mappings have been configured for the sqlite db this will be added shortly after database is operational.

Configuration Files

Dockerfile Contents

FROM python:3.10.5-slim

ENV PYTHONUNBUFFERED 1

EXPOSE 8000
WORKDIR /app

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

# Install underlying platform updates
RUN apt-get update && \
    apt-get install -y --no-install-recommends netcat git && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install poetry requirements
COPY poetry.lock pyproject.toml /app
RUN pip install poetry && \
    poetry export --without-hashes > requirements.txt && \
    pip install -r requirements.txt
# poetry config virtualenvs.in-project true && \
# poetry install --no-dev

COPY . /app

# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser

CMD ["gunicorn", "--bind", "0.0.0.0:8000", "-k", "uvicorn.workers.UvicornWorker", "app.main:app"]

Docker-Compose contents

version: '3.8'

services:
  makerhub:
    image: makerhub
    build:
      context: .
      dockerfile: ./Dockerfile
    ports:
      - 8080:8000