Skip to content

Commit 6af8672

Browse files
authored
Merge pull request #31 from Eventdisplay/fix-output-docker-files
Maintenace PR - mostly updating / simplifying the docker files.
2 parents 637be33 + 84fa663 commit 6af8672

7 files changed

Lines changed: 39 additions & 53 deletions

File tree

.github/workflows/packages-dl3-irfs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,28 @@ jobs:
2121

2222
steps:
2323
- name: Checkout repository
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v5
2525
with:
2626
path: 'Converters'
2727

2828
- name: Log in to the Container registry
29-
uses: docker/login-action@v2
29+
uses: docker/login-action@v3
3030
with:
3131
registry: ${{ env.REGISTRY }}
3232
username: ${{ github.actor }}
3333
password: ${{ secrets.GITHUB_TOKEN }}
3434

3535
- name: Extract metadata (tags, labels) for Docker
3636
id: meta
37-
uses: docker/metadata-action@v4
37+
uses: docker/metadata-action@v5
3838
with:
3939
tags: |
4040
type=ref,event=pr,suffix=-dl3-irfs
4141
type=semver,pattern={{major}}.{{minor}}.{{patch}},suffix=-dl3-irfs
4242
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4343

4444
- name: Build and push Docker image
45-
uses: docker/build-push-action@v3
45+
uses: docker/build-push-action@v6
4646
with:
4747
context: .
4848
push: ${{ github.event_name != 'pull_request' }}

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
repos:
22
# https://pycqa.github.io/isort/docs/configuration/black_compatibility.html#integration-with-pre-commit
33
- repo: https://github.com/pycqa/isort
4-
rev: 5.12.0
4+
rev: 7.0.0
55
hooks:
66
- id: isort
77
args: ["--profile", "black", "--filter-files"]
88
- repo: https://github.com/psf/black
9-
rev: 23.7.0
9+
rev: 25.11.0
1010
hooks:
1111
- id: black
1212
args: ["--line-length=100"]
1313
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html?highlight=other%20tools#flake8
1414
- repo: https://github.com/PyCQA/flake8
15-
rev: 6.1.0
15+
rev: 7.3.0
1616
hooks:
1717
- id: flake8
1818
args: ["--max-line-length=100", "--extend-ignore=E203,E712"]
1919
# https://github.com/pre-commit/pre-commit-hooks
2020
- repo: https://github.com/pre-commit/pre-commit-hooks
21-
rev: v4.4.0
21+
rev: v6.0.0
2222
hooks:
2323
- id: check-yaml
2424
- id: trailing-whitespace

DL2/Dockerfile

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
# Dockerfile to build DL2 Converter for Eventdisplay
2-
FROM python:3.10-slim
2+
FROM mambaorg/micromamba:latest
33
ENV LC_ALL=C
44

55
LABEL maintainer.name="Eventdisplay Team"
66
LABEL maintainer.email="gernot.maier@desy.de"
77
ENV DEBIAN_FRONTEND=noninteractive
88

9-
RUN apt-get update && \
10-
apt-get -y upgrade && \
11-
apt-get install -y --no-install-recommends wget && \
12-
apt-get clean && \
13-
rm -rf /var/lib/apt/lists/*
14-
15-
ENV PATH /conda/bin:$PATH
16-
ENV PYTHONPATH=$PYTHONPATH:"/"
17-
18-
COPY Converters/DL2/environment.yml environment.yml
19-
20-
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
21-
/bin/bash ~/miniconda.sh -b -p /conda && \
22-
rm ~/miniconda.sh
23-
RUN conda env update -n base --file environment.yml && \
24-
conda clean --all
25-
269
WORKDIR /workdir/
2710

28-
SHELL ["/bin/bash", "-c"]
11+
COPY Converters/DL2/environment.yml /tmp/environment.yml
12+
13+
# Create environment using micromamba
14+
RUN micromamba install -y -n base -f /tmp/environment.yml && \
15+
micromamba clean -a -y
2916

30-
RUN source /root/.bashrc && \
31-
conda init bash
17+
ENV PATH="/opt/conda/bin:$PATH"

DL2/generate_DL2_file.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ def cli(filenames, cut_level, debug, output, layout, event_type):
111111
if event_type > 0:
112112
logging.info(f"Number of events within event_type file: {len(event_types)}")
113113
ratio = np.sum(event_types == -1) / len(event_types)
114-
logging.info(
115-
f"Ratio of training to simulated events: {ratio}"
116-
)
114+
logging.info(f"Ratio of training to simulated events: {ratio}")
117115
logging.info(f"len(data_mask): {len(data_mask)}")
118116
data_mask[data_mask] = event_types == event_type
119117
if np.sum(data_mask) == 0:
@@ -165,12 +163,12 @@ def cli(filenames, cut_level, debug, output, layout, event_type):
165163
# Create primary HDU:
166164
primary_hdu = fits.PrimaryHDU()
167165
primary_hdu.header["TELESCOP"] = layout, "Telescope and array codename"
168-
primary_hdu.header[
169-
"COMMENT"
170-
] = "FITS (Flexible Image Transport System) format is defined in 'Astronomy"
171-
primary_hdu.header[
172-
"COMMENT"
173-
] = "and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H"
166+
primary_hdu.header["COMMENT"] = (
167+
"FITS (Flexible Image Transport System) format is defined in 'Astronomy"
168+
)
169+
primary_hdu.header["COMMENT"] = (
170+
"and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H"
171+
)
174172

175173
# Create HDU
176174
header = fits.Header()

DL3-IRFs/Dockerfile

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
# Dockerfile to build DL3-IRFs Converter for Eventdisplay
2-
From rootproject/root:6.30.02-ubuntu22.04
2+
FROM rootproject/root:6.30.02-ubuntu22.04
33
ENV LC_ALL=C
44

55
LABEL maintainer.name="Eventdisplay Team"
66
LABEL maintainer.email="gernot.maier@desy.de"
77

8-
# force ubunto to use bash for /bin/sh
8+
# force ubuntu to use bash for /bin/sh
99
RUN yes no | dpkg-reconfigure dash
1010

1111
## Basic packages
12-
RUN apt-get update && apt-get install -y \
13-
git
14-
RUN apt-get clean
12+
RUN apt-get update && \
13+
apt-get install --no-install-recommends -y git && \
14+
apt-get clean && \
15+
rm -rf /var/lib/apt/lists/*
16+
1517
WORKDIR /data/
16-
ENV DATA /data/
18+
ENV DATA=/data/
1719

18-
# Install and compile cfitsio
19-
RUN wget --quiet http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.3.1.tar.gz && \
20-
tar -xzf cfitsio-4.3.1.tar.gz && \
21-
cd cfitsio-4.3.1 && \
20+
## Install and compile cfitsio from GitHub at tag cfitsio-4.6.3
21+
RUN git clone https://github.com/HEASARC/cfitsio.git && \
22+
cd cfitsio && \
23+
git checkout cfitsio-4.6.3 && \
2224
./configure --prefix=${DATA}/ && \
2325
make && \
2426
make install && \
2527
make clean && \
26-
cd .. && rm -f cfitsio-4.3.1.tar.gz
28+
cd .. && rm -rf cfitsio
2729

28-
ENV LD_LIBRARY_PATH "${DATA}/lib:${LD_LIBRARY_PATH}"
30+
ENV LD_LIBRARY_PATH="${DATA}/lib:${LD_LIBRARY_PATH}"
2931

3032
# Install and compile DL3 converter
3133
RUN git clone https://github.com/Eventdisplay/Converters.git && \

DL3-IRFs/src/test_cta_file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Test program for OGADF scheme using ogadf_schema
22
"""
3-
usage: python src/test_cta_file.py <file.fits.gz>
4-
(only 3D implemented at this point)
3+
usage: python src/test_cta_file.py <file.fits.gz>
4+
(only 3D implemented at this point)
55
"""
66
import logging
77
import sys

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2020, Eventdisplay
3+
Copyright (c) 2020-2025, Eventdisplay Developers
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

0 commit comments

Comments
 (0)