-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(docker): update and fix dockerfile, add pre-commit to dev deps
Signed-off-by: David Wallace <[email protected]>
- Loading branch information
David Wallace
committed
Feb 9, 2025
1 parent
dc7abe0
commit 0f37a9c
Showing
4 changed files
with
150 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.venv/ | ||
# Ignore the 'data' and 'output' directories | ||
data/ | ||
output/ | ||
examples/ | ||
|
||
# Ignore Python bytecode files and cache directories | ||
*.pyc | ||
*.pyo | ||
__pycache__/ | ||
|
||
# Ignore any other unnecessary files (e.g., logs, test outputs) | ||
*.log | ||
*.bak | ||
*.swp | ||
|
||
# Optionally, ignore other common file types you don't want in the image | ||
*.git | ||
*.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
# set base image (host OS) | ||
FROM python:3.12 | ||
# Use a Python image with uv pre-installed | ||
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim | ||
|
||
RUN addgroup -S nonroot \ | ||
&& adduser -S nonroot -G nonroot | ||
# Install the project into `/app` | ||
WORKDIR /app | ||
|
||
USER nonroot | ||
# Enable bytecode compilation | ||
ENV UV_COMPILE_BYTECODE=1 | ||
|
||
# set the working directory in the container | ||
WORKDIR /code | ||
# Copy from the cache instead of linking since it's a mounted volume | ||
ENV UV_LINK_MODE=copy | ||
|
||
# copy the dependencies file to the working directory | ||
COPY ./raman-fitting ./raman-fitting | ||
# Install the project's dependencies using the lockfile and settings | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
--mount=type=bind,source=uv.lock,target=uv.lock \ | ||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | ||
uv sync --frozen --no-install-project | ||
|
||
# copy setup.cfg to work dir | ||
# COPY setup.cfg . | ||
# COPY setup.py . | ||
# install package test, maybe not possible because only src | ||
# RUN pip install -e ./ | ||
# Then, add the rest of the project source code and install it | ||
# Installing separately from its dependencies allows optimal layer caching | ||
ADD . /app | ||
|
||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
uv sync --frozen | ||
|
||
# install dependencies | ||
RUN pip install -r requirements.txt | ||
# Place executables in the environment at the front of the path | ||
ENV PATH="/app/.venv/bin:$PATH" | ||
|
||
RUN pip install --upgrade build | ||
RUN build ./ | ||
RUN pip install -e ./ | ||
# Reset the entrypoint, don't invoke `uv` | ||
ENTRYPOINT ["uv", "run"] | ||
|
||
# copy the content of the local src directory to the working directory | ||
#COPY src/ . | ||
|
||
# command to run on container start | ||
CMD [ "raman_fitting run examples" ] | ||
# Default command | ||
CMD ["raman_fitting", "run", "examples"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ authors = [ | |
{name = "David Wallace", email = "[email protected]"}, | ||
] | ||
description = "Python framework for the batch processing and deconvolution of raman spectra." | ||
readme = {file = "README.md", content-type = "text/markdown"} | ||
readme = "README.md" | ||
keywords = ["spectroscopy", "Raman", "fitting", "deconvolution", "batch processing", "carbonaceous materials"] | ||
classifiers = [ | ||
"License :: OSI Approved :: MIT License", | ||
|
@@ -57,6 +57,7 @@ dev = [ | |
"pydocstyle", | ||
"black", | ||
"ruff", | ||
"pre-commit", | ||
"bump-my-version", | ||
{include-group = "pytest"} | ||
] | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.