Skip to content

Commit

Permalink
fix: Docker full or minimal, make docker, README clean
Browse files Browse the repository at this point in the history
Dockerfile now conditionally builds with minimal requirements or full
requirements if docker build --build-arg BUILD=full set.

Makefile now has `make docker` which will build a full requirements and
let you edit your development source

README is markdownlint'ed
  • Loading branch information
richtong committed Apr 19, 2024
1 parent b43324b commit 6d2e471
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 96 deletions.
22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
FROM python:3.11.5-bookworm
# https://stackoverflow.com/questions/31528384/conditional-copy-add-in-dockerfile
# full means do a full requirements copy
ARG BUILD=base

RUN mkdir SlashGPT
WORKDIR /SlashGPT
FROM python:3.11.5-bookworm as slashgpt_base
ONBUILD COPY requirements.txt requirements.txt

FROM python:3.11.5-bookworm as slashgpt_full
ONBUILD COPY requirements/full.txt requirements.txt

# hadolint ignore=DL3006
FROM slashgpt_${BUILD}
RUN pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir playsound==1.3.0

WORKDIR /SlashGPT
RUN git clone https://github.com/snakajima/SlashGPT.git

WORKDIR /SlashGPT/SlashGPT

RUN pip install -r requirements.txt
RUN pip install playsound
COPY .env .env
COPY .env .env
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,14 @@ before_commit:
make test
make format
make lint

## docker: run docker development environment with full requirements
.PHONY: docker
docker:
docker build --build-arg BUILD=full -t slashgpt .
docker run -it -v "$(PWD):/SlashGPT/SlashGPT" slashgpt python -m pdb SlashGPT.py

## dev: run debugging environment in poetry
.PHONY: dev
dev:
poetry run python -m pdb SlashGPT.py
Loading

0 comments on commit 6d2e471

Please sign in to comment.