Skip to content

Commit 89001c2

Browse files
author
Daniel Garcia Briseno
committed
Check out sunpy with patch
1 parent be394fd commit 89001c2

3 files changed

Lines changed: 32 additions & 15 deletions

File tree

‎app/Dockerfile‎

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,48 @@
1+
# Builder stage - has all build tools
2+
FROM condaforge/mambaforge AS builder
3+
4+
WORKDIR /build
5+
COPY requirements.txt .
6+
7+
# This is where pip will be after the conda environment is created
8+
ENV PIP=/opt/conda/envs/coordinator/bin/pip
9+
10+
# Create conda environment and install dependencies
11+
RUN mamba create -n coordinator -y python=3.13.5 gcc \
12+
&& cd /tmp \
13+
&& git clone https://github.com/sunpy/sunpy.git \
14+
&& cd sunpy \
15+
&& git fetch origin pull/8500/head:pr-8500 \
16+
&& git checkout pr-8500 \
17+
&& mamba run -n coordinator pip install --no-cache-dir . \
18+
&& cd /build \
19+
&& mamba run -n coordinator pip install --no-cache-dir -r requirements.txt \
20+
&& rm -rf /tmp/sunpy
21+
22+
# Final stage - minimal runtime image
123
FROM condaforge/mambaforge
224

325
RUN apt update && apt install -y curl
426

527
# Create and switch to non-root user
628
RUN useradd -m -s /bin/bash nonroot
729
WORKDIR /home/nonroot/app
8-
USER nonroot
30+
31+
# Copy conda environment from builder (keep same path)
32+
COPY --from=builder /opt/conda/envs/coordinator /opt/conda/envs/coordinator
933

1034
# copy application files to the container
1135
COPY --chown=nonroot:nonroot . .
1236

37+
USER nonroot
38+
1339
# This is where pip will be after the conda environment is created
1440
# can't conda activate in dockerfile
15-
ENV PIP=/home/nonroot/.conda/envs/coordinator/bin/pip
16-
17-
# Install dependencies in conda environment
18-
RUN <<EOF
19-
mamba create -n coordinator -y python=3.13.1
20-
$PIP install --no-cache-dir -r requirements.txt
21-
EOF
41+
ENV PIP=/opt/conda/envs/coordinator/bin/pip
2242

2343
HEALTHCHECK --interval=2s --timeout=10s \
2444
CMD curl --silent --fail "http://127.0.0.1/health-check"
2545

26-
ENTRYPOINT ["/home/nonroot/.conda/envs/coordinator/bin/python"]
46+
ENTRYPOINT ["/opt/conda/envs/coordinator/bin/python"]
2747

2848
CMD ["-m", "fastapi", "run", "--workers", "4", "--port", "80", "main.py"]

‎app/requirements-dev.txt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1+
black==26.1.0
12
pytest==9.0.2
2-
httpx==0.28.1
3-
black==25.12.0

‎app/requirements.txt‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
astropy==7.2.0
2-
sunpy==7.1.0
3-
matplotlib==3.10.8
41
reproject==0.19.0
5-
mpl_animators==1.2.4
62
fastapi[standard]==0.128.0
3+
matplotlib==3.10.8
4+
mpl_animators==1.2.4

0 commit comments

Comments
 (0)