Skip to content

Commit

Permalink
Updated docs and examples for V4 (#232)
Browse files Browse the repository at this point in the history
- added some config examples
- added deprecated warnings
- removes unused scripts and files
  • Loading branch information
sidey79 authored May 12, 2024
2 parents acb7771 + 8acd76d commit c5a4cb8
Show file tree
Hide file tree
Showing 18 changed files with 220 additions and 599 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
src/FHEM/trunk
.github
.vscode
.vscode
.cache
33 changes: 31 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,13 @@ jobs:
name: Run bats unit and integration tests in bidge network mode
with:
attempt_limit: 3
command: timeout 9m docker run --rm -e GITHUB_RUN_ID=$GITHUB_RUN_ID -v "${PWD}/src/tests/bats:/code" bats-withfhem:latest -T -t . --filter-tags '!hostMode'
command: timeout 9m docker run --rm -e GITHUB_RUN_ID=$GITHUB_RUN_ID -v "${PWD}/src/tests/bats:/code" bats-withfhem:latest -T -t . --filter-tags '!hostMode,!extendedOnly'

- uses: Wandalen/[email protected]
name: Run bats unit and integration tests in host network mode
with:
attempt_limit: 3
command: timeout 1m docker run --rm --net=host -e GITHUB_RUN_ID=$GITHUB_RUN_ID -v "${PWD}/src/tests/bats:/code" bats-withfhem:latest -T -t . --filter-tags 'hostMode'
command: timeout 1m docker run --rm --net=host -e GITHUB_RUN_ID=$GITHUB_RUN_ID -v "${PWD}/src/tests/bats:/code" bats-withfhem:latest -T -t . --filter-tags 'hostMode,!extendedOnly'

- name: Build for test fhem, python and nodejs layer added for amd64
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -353,6 +353,35 @@ jobs:
docker exec ${CONTAINER} /bin/bash -c "prove --exec 'perl fhem.pl -t' -I FHEM --recurse /opt/fhem/t/FHEM/" || true
docker container rm $CONTAINER --force --volumes
- name: Build for bats with fhem extended layer
uses: docker/build-push-action@v5
id: docker_build_bats_extended
with:
context: .
load: true
file: ./Dockerfile${{ matrix.dockerfile }}
platforms: linux/amd64
push: false
target: with-fhem-bats-extended-python-nodejs
cache-from: |
type=gha,scope=fhem_linux/amd64-${{ matrix.dockerfile }}
type=gha,mode=max,scope=full_linux/amd64-${{ matrix.dockerfile }}
tags: bats-withfhem-extended
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
IMAGE_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
IMAGE_VCS_REF=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
L_USAGE=${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/README.md
L_VCS_URL=${{ github.server_url }}/${{ github.repository }}/
L_AUTHORS=${{ github.server_url }}/${{ github.repository }}/graphs/contributors
- uses: Wandalen/[email protected]
name: Run bats unit and integration tests in host network mode
with:
attempt_limit: 3
command: timeout 1m docker run --rm -e GITHUB_RUN_ID=$GITHUB_RUN_ID -v "${PWD}/src/tests/bats:/code" bats-withfhem-extended:latest -T -t . --filter-tags 'extendedOnly'

published_build:
runs-on: ubuntu-latest
needs: [test_build, cpan_build]
Expand Down
145 changes: 0 additions & 145 deletions .travis_old.yml

This file was deleted.

25 changes: 20 additions & 5 deletions Dockerfile-bullseye
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ LABEL org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${IMAGE_VCS_REF} \
org.opencontainers.image.vendor=${L_VENDOR} \
org.opencontainers.image.licenses=${L_LICENSES} \
org.opencontainers.image.title=${L_TITLE} \
org.opencontainers.image.description=${L_DESCR}
org.opencontainers.image.title=${L_TITLE}
LABEL org.opencontainers.image.description=${L_DESCR}

RUN chmod 755 /*.sh /usr/local/bin/* \
&& echo "org.opencontainers.image.created=${BUILD_DATE}\norg.opencontainers.image.authors=${L_AUTHORS}\norg.opencontainers.image.url=${L_URL}\norg.opencontainers.image.documentation=${L_USAGE}\norg.opencontainers.image.source=${L_VCS_URL}\norg.opencontainers.image.version=${IMAGE_VERSION}\norg.opencontainers.image.revision=${IMAGE_VCS_REF}\norg.opencontainers.image.vendor=${L_VENDOR}\norg.opencontainers.image.licenses=${L_LICENSES}\norg.opencontainers.image.title=${L_TITLE}\norg.opencontainers.image.description=${L_DESCR}\norg.fhem.authors=${L_AUTHORS_FHEM}\norg.fhem.url=${L_URL_FHEM}\norg.fhem.documentation=${L_USAGE_FHEM}\norg.fhem.source=${L_VCS_URL_FHEM}\norg.fhem.version=${FHEM_VERSION}\norg.fhem.vendor=${L_VENDOR_FHEM}\norg.fhem.licenses=${L_LICENSES_FHEM}\norg.fhem.description=${L_DESCR_FHEM}" > /image_info
Expand Down Expand Up @@ -290,7 +290,7 @@ RUN <<EOF
python3-wheel \
python3-pychromecast \
speedtest-cli \
youtube-dl \
youtube-dl
ln -s ../../bin/speedtest-cli /usr/local/bin/speedtest-cli
LC_ALL=C apt-get autoremove -qqy && LC_ALL=C apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.[^.] ~/.??* ~/*
Expand All @@ -307,8 +307,8 @@ RUN <<EOF
mkdir -p /tmp/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /tmp/keyrings/nodesource.gpg
echo "deb [signed-by=/tmp/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
apt-get update
LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install nodejs -y
LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get update
LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends nodejs
npm install -g npm@latest
if [ "${IMAGE_LAYER_NODEJS_EXT}" != "0" ]; then
npm install -g --unsafe-perm --production \
Expand Down Expand Up @@ -345,3 +345,18 @@ ADD https://github.com/grayhemp/bats-mock.git /opt/bats/test_helper/bats-mock
WORKDIR /code/

ENTRYPOINT [ "/usr/local/bin/bats" ]


#
#
# Layer for bash integration testing
#
#
FROM with-fhem-extended-python-nodejs as with-fhem-bats-extended-python-nodejs

COPY --from=with-fhem-bats /opt/bats /opt/bats/
RUN ln -s /opt/bats/bin/bats /usr/local/bin/bats

WORKDIR /code/

ENTRYPOINT [ "/usr/local/bin/bats" ]
25 changes: 20 additions & 5 deletions Dockerfile-threaded-bullseye
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ LABEL org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${IMAGE_VCS_REF} \
org.opencontainers.image.vendor=${L_VENDOR} \
org.opencontainers.image.licenses=${L_LICENSES} \
org.opencontainers.image.title=${L_TITLE} \
org.opencontainers.image.description=${L_DESCR}
org.opencontainers.image.title=${L_TITLE}
LABEL org.opencontainers.image.description=${L_DESCR}

RUN chmod 755 /*.sh /usr/local/bin/* \
&& echo "org.opencontainers.image.created=${BUILD_DATE}\norg.opencontainers.image.authors=${L_AUTHORS}\norg.opencontainers.image.url=${L_URL}\norg.opencontainers.image.documentation=${L_USAGE}\norg.opencontainers.image.source=${L_VCS_URL}\norg.opencontainers.image.version=${IMAGE_VERSION}\norg.opencontainers.image.revision=${IMAGE_VCS_REF}\norg.opencontainers.image.vendor=${L_VENDOR}\norg.opencontainers.image.licenses=${L_LICENSES}\norg.opencontainers.image.title=${L_TITLE}\norg.opencontainers.image.description=${L_DESCR}\norg.fhem.authors=${L_AUTHORS_FHEM}\norg.fhem.url=${L_URL_FHEM}\norg.fhem.documentation=${L_USAGE_FHEM}\norg.fhem.source=${L_VCS_URL_FHEM}\norg.fhem.version=${FHEM_VERSION}\norg.fhem.vendor=${L_VENDOR_FHEM}\norg.fhem.licenses=${L_LICENSES_FHEM}\norg.fhem.description=${L_DESCR_FHEM}" > /image_info
Expand Down Expand Up @@ -290,7 +290,7 @@ RUN <<EOF
python3-wheel \
python3-pychromecast \
speedtest-cli \
youtube-dl \
youtube-dl
ln -s ../../bin/speedtest-cli /usr/local/bin/speedtest-cli
LC_ALL=C apt-get autoremove -qqy && LC_ALL=C apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.[^.] ~/.??* ~/*
Expand All @@ -307,8 +307,8 @@ RUN <<EOF
mkdir -p /tmp/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /tmp/keyrings/nodesource.gpg
echo "deb [signed-by=/tmp/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
apt-get update
LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install nodejs -y
LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get update
LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends nodejs
npm install -g npm@latest
if [ "${IMAGE_LAYER_NODEJS_EXT}" != "0" ]; then
npm install -g --unsafe-perm --production \
Expand Down Expand Up @@ -345,3 +345,18 @@ ADD https://github.com/grayhemp/bats-mock.git /opt/bats/test_helper/bats-mock
WORKDIR /code/

ENTRYPOINT [ "/usr/local/bin/bats" ]


#
#
# Layer for bash integration testing
#
#
FROM with-fhem-extended-python-nodejs as with-fhem-bats-extended-python-nodejs

COPY --from=with-fhem-bats /opt/bats /opt/bats/
RUN ln -s /opt/bats/bin/bats /usr/local/bin/bats

WORKDIR /code/

ENTRYPOINT [ "/usr/local/bin/bats" ]
3 changes: 0 additions & 3 deletions config.json

This file was deleted.

29 changes: 25 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,25 @@ services:
TZ: Europe/Berlin


# example with extending debian packages to the image
# example with adding a cpan packages to your image
fhem:
build:
context: .
dockerfile_inline: |
FROM ghcr.io/fhem/fhem-docker:4-bullseye
RUN <<EOF
cpm install --show-build-log-on-failure --configure-timeout=360 --workers=$(nproc) --local-lib-contained /usr/src/app/3rdparty/ << YOUR PAACKAGE NAME >>
EOF
pull_policy: build
restart: always
networks:
- net
ports:
- "8083:8083"
volumes:
- "./fhem/:/opt/fhem/"

# example with extending debian packages to your image
fhem:
build:
context: .
Expand All @@ -124,6 +142,7 @@ services:
LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends <DEBIAN PACKAGENAME>
LC_ALL=C apt-get autoremove -qqy && LC_ALL=C apt-get clean
EOF
pull_policy: build
restart: always
networks:
- net
Expand All @@ -132,7 +151,7 @@ services:
volumes:
- "./fhem/:/opt/fhem/"

# example with extending npm packages to the image
# example with extending npm packages to your image
fhem:
build:
context: .
Expand All @@ -142,6 +161,7 @@ services:
npm install -g --unsafe-perm --production <NPM PACKAGENAME>
npm cache clean --force
EOF
pull_policy: build
restart: always
networks:
- net
Expand All @@ -151,15 +171,16 @@ services:
- "./fhem/:/opt/fhem/"


# example with extending python packages to the image
# example with extending python packages to your image
fhem:
build:
context: .
dockerfile_inline: |
FROM ghcr.io/fhem/fhem-docker:4-bullseye
RUN <<EOF
pip install --no-cache-dir <PIP PACKAGENAME>
pip3 install --no-cache-dir <PIP PACKAGENAME>
EOF
pull_policy: build
restart: always
networks:
- net
Expand Down
Loading

0 comments on commit c5a4cb8

Please sign in to comment.