Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v1.1.0]

### Added

- Added pre-commit configuration for linting and formatting [!6](https://github.com/dmidk/sunflow/pull/6), @khintz
Expand All @@ -15,7 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Add .gitignore file and remove unnecessary files from the repository [!1](https://github.com/dmidk/sunflow/pull/1), @khintz
- Optimize container image size using multi-stage build and removing build-time dependencies [#9](https://github.com/dmidk/sunflow/pull/9), @khintz

## [1.0.0]
## [v1.0.0]

Initial release of Sunflow. The application performs real-time or historical short-term solar irradiance nowcasting using probabilistic advection (via [SolarSTEPS](https://github.com/EnergyWeatherAI/SolarSTEPS)) with satellite data from KNMI MSG-CPP or DWD SIS. It supports local file, API download, and S3 run modes, produces CF-compliant NetCDF4 forecast files, and can be run as a container via Podman/Docker.
49 changes: 37 additions & 12 deletions ContainerFile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM python:3.12
FROM python:3.12-slim-bookworm AS builder

ENV DEBIAN_FRONTEND=noninteractive

# Install system dependencies including git and Python dev headers
# Install build-time dependencies only in the builder stage.
RUN apt-get update -y && \
apt-get install -y \
apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
libgeos-dev \
Expand All @@ -18,27 +18,52 @@ RUN apt-get update -y && \
curl && \
rm -rf /var/lib/apt/lists/*

# Set up container environment
ENV USER_ID=1000
ENV GROUP_ID=1000

# Install uv for fast dependency resolution and installation
# Install uv only in the builder stage.
RUN curl -LsSf https://astral.sh/uv/install.sh | sh

ENV PATH="${PATH}:/root/.local/bin"

# Create application directories
RUN mkdir -p /data/nowcasts /data/satellite_data
WORKDIR /project

# Copy project files
COPY pyproject.toml /project/
COPY uv.lock /project/
COPY sunflow/ /project/sunflow/
COPY README.md /project/
COPY config.yaml /project/

# Install project dependencies
RUN uv sync --frozen --no-dev
RUN uv sync --frozen --no-dev && \
rm -rf /root/.cache/uv /root/.cache/pip

FROM python:3.12-slim-bookworm

ENV DEBIAN_FRONTEND=noninteractive

# Install only the runtime shared libraries needed by the wheels.
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
ca-certificates \
libgomp1 \
libgeos-c1v5 \
libproj25 \
proj-data \
proj-bin \
libhdf5-103-1 \
libnetcdf19 && \
rm -rf /var/lib/apt/lists/*
Comment thread
elbdmi marked this conversation as resolved.

ENV USER_ID=1000
ENV GROUP_ID=1000
ENV VIRTUAL_ENV=/project/.venv
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"

WORKDIR /project

COPY --from=builder /project/.venv /project/.venv
COPY pyproject.toml /project/
COPY sunflow/ /project/sunflow/
COPY README.md /project/
COPY config.yaml /project/

ENTRYPOINT ["uv", "run", "python", "-m", "sunflow.main"]
ENTRYPOINT ["/project/.venv/bin/python", "-m", "sunflow.main"]
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies = [
"isodate>=0.7.2",
"fsspec>=2023.1.0",
"s3fs>=2023.1.0",
"PyYAML>=6.0.2",
]
requires-python = ">=3.12"
readme = "README.md"
Expand Down
2 changes: 2 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading