Skip to content

Commit

Permalink
Bump modules and remove faup
Browse files Browse the repository at this point in the history
  • Loading branch information
ostefano committed Feb 26, 2025
1 parent 9d95b9a commit 7c62805
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/bake-action@v4
uses: docker/bake-action@v5
with:
push: true
provenance: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-build-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
echo "NAMESPACE=local" >> "$GITHUB_ENV"
- name: Build
uses: docker/bake-action@v4
uses: docker/bake-action@v5
with:
push: false
provenance: false
Expand Down
4 changes: 2 additions & 2 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ variable "MODULES_COMMIT" {
default = ""
}

variable "LIBFAUP_COMMIT" {
variable "MODULES_INSTALL_FLAG" {
default = ""
}

Expand Down Expand Up @@ -88,7 +88,7 @@ target "misp-modules" {
args = {
"MODULES_TAG": "${MODULES_TAG}",
"MODULES_COMMIT": "${MODULES_COMMIT}",
"LIBFAUP_COMMIT": "${LIBFAUP_COMMIT}",
"MODULES_INSTALL_FLAG": "${MODULES_INSTALL_FLAG}",
}
platforms = "${PLATFORMS}"
}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ services:
args:
- MODULES_TAG=${MODULES_TAG:?Missing .env file, see README.md for instructions}
- MODULES_COMMIT=${MODULES_COMMIT}
- LIBFAUP_COMMIT=${LIBFAUP_COMMIT:?Missing .env file, see README.md for instructions}
- MODULES_INSTALL_FLAG=${MODULES_INSTALL_FLAG:?Missing .env file, see README.md for instructions}
environment:
- "REDIS_BACKEND=${REDIS_HOST:-redis}"
- "REDIS_PORT=${REDIS_PORT:-6379}"
Expand Down
32 changes: 3 additions & 29 deletions modules/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm" AS python-build
ENV DEBIAN_FRONTEND noninteractive

Check warning on line 4 in modules/Dockerfile

View workflow job for this annotation

GitHub Actions / build (misp-modules)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

Check warning on line 4 in modules/Dockerfile

View workflow job for this annotation

GitHub Actions / build (misp-modules)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
ARG MODULES_TAG
ARG MODULES_COMMIT
ARG LIBFAUP_COMMIT
ARG MODULES_INSTALL_FLAG

# Uncomment when building in corporate environments
# COPY ./cert.pem /usr/local/share/ca-certificates/rootca.pem
Expand All @@ -21,7 +21,6 @@ FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm" AS python-build
libxml2-dev \
libxslt-dev \
libssl-dev \
ninja-build \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*

RUN mkdir /wheels
Expand All @@ -39,31 +38,13 @@ EOF
RUN sed -i "s/^requires-python = .*/requires-python = \"$(python -c 'import platform; print(platform.python_version())')\"/" pyproject.toml
RUN poetry lock
RUN poetry self add poetry-plugin-export
RUN poetry export --with unstable --without-hashes -f requirements.txt -o requirements.txt
RUN poetry export ${MODULES_INSTALL_FLAG} --without-hashes -f requirements.txt -o requirements.txt
RUN pip wheel -r requirements.txt --no-cache-dir -w /wheels/
RUN poetry build --output /wheels/

WORKDIR /srv/
RUN rm -rf /srv/misp-modules

RUN <<-EOF
git clone https://github.com/stricaud/faup.git /srv/faup
cd /srv/faup
if [ ! -z ${LIBFAUP_COMMIT} ]; then
git checkout ${LIBFAUP_COMMIT}
fi
EOF

WORKDIR /srv/faup/build
RUN cmake -G "Ninja" ../
RUN ninja
RUN ninja install
WORKDIR /srv/faup/src/lib/bindings/python
RUN pip wheel --no-cache-dir --no-dependencies -w /wheels/ .

WORKDIR /srv/
RUN rm -rf /srv/faup


FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm"
ENV DEBIAN_FRONTEND noninteractive

Check warning on line 50 in modules/Dockerfile

View workflow job for this annotation

GitHub Actions / build (misp-modules)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

Check warning on line 50 in modules/Dockerfile

View workflow job for this annotation

GitHub Actions / build (misp-modules)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
Expand All @@ -81,16 +62,9 @@ FROM "${DOCKER_HUB_PROXY}python:3.12-slim-bookworm"
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*

COPY --from=python-build /wheels /wheels
COPY --from=python-build /usr/local/lib/libfaupl* /usr/local/lib/
RUN ldconfig
RUN pip install --no-cache-dir --use-deprecated=legacy-resolver /wheels/*.whl && rm -rf /wheels
RUN pip install --no-cache-dir /wheels/*.whl && rm -rf /wheels
RUN pip uninstall -y pip

# Since we compile faup ourselves and lua is not required anymore, we can load our own library
# and skip the pre-compiled blob to improve compatibility with other architectures like ARM
RUN sed -i s/LoadLibrary\(LOAD_LIB\)/LoadLibrary\(\"\\/usr\\/local\\/lib\\/libfaupl.so\"\)/ \
/usr/local/lib/python3.12/site-packages/pyfaup/__init__.py

# Disable (all) warnings raised when using 'future'
RUN sed -i '/import sys/a import warnings\nwarnings.warn = lambda *args, **kwargs: None' \
/usr/local/bin/misp-modules
Expand Down
4 changes: 2 additions & 2 deletions template.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
##

CORE_TAG=v2.5.7
MODULES_TAG=v2.4.200
MODULES_TAG=v2.4.201
MODULES_INSTALL_FLAG=--with unstable
PHP_VER=20220829
LIBFAUP_COMMIT=3a26d0a

# PYPY_* vars take precedence over MISP's
# PYPI_REDIS_VERSION="==5.0.*"
Expand Down

0 comments on commit 7c62805

Please sign in to comment.