Skip to content

Commit

Permalink
Basic valgrind massif docker
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumEntangledAndy committed Apr 9, 2024
1 parent d354b90 commit 31048ed
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ jobs:
echo "GSTREAMER_1_0_ROOT_MSVC_X86_64=${GSTREAMER_1_0_ROOT_MSVC_X86_64}"
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}"
# pkg-config --variable pc_path pkg-config
cargo build --release --all-features
cargo build --debug --all-features
- uses: actions/upload-artifact@v3
with:
name: release-${{ matrix.os }}
path: "target/release/neolink*"
name: debug-${{ matrix.os }}
path: "target/debug/neolink*"
cross:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
Expand Down Expand Up @@ -182,16 +182,16 @@ jobs:
TARGET: ${{ matrix.target }}
- name: Build
run: |
cargo build --verbose --release --all-features --target=${TARGET}
cargo build --verbose --debug --all-features --target=${TARGET}
env:
# Retarget pkg-config as described in https://www.freedesktop.org/wiki/Software/pkg-config/CrossCompileProposal/
PKG_CONFIG_ALLOW_CROSS: 1
PKG_CONFIG_LIBDIR: /usr/lib/${{ matrix.pkgconfig }}/pkgconfig
TARGET: ${{ matrix.target }}
- uses: actions/upload-artifact@v3
with:
name: release-${{ matrix.arch }}-bookworm
path: "target/${{ matrix.target }}/release/neolink*"
name: debug-${{ matrix.arch }}-bookworm
path: "target/${{ matrix.target }}/debug/neolink*"

push_to_registry:
name: Build Docker image
Expand Down Expand Up @@ -299,22 +299,22 @@ jobs:
- name: Download Linux x86_64
uses: actions/download-artifact@v3
with:
name: release-amd64-bookworm
name: debug-amd64-bookworm
path: linux/amd64
- name: Download Linux armv7
uses: actions/download-artifact@v3
with:
name: release-armhf-bookworm
name: debug-armhf-bookworm
path: linux/arm/v7
- name: Download Linux arm64
uses: actions/download-artifact@v3
with:
name: release-arm64-bookworm
name: debug-arm64-bookworm
path: linux/arm64
- name: Download Linux i386
uses: actions/download-artifact@v3
with:
name: release-i386-bookworm
name: debug-i386-bookworm
path: linux/386
- name: Push to Docker Hub
if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }}
Expand All @@ -329,8 +329,8 @@ jobs:
env:
DOCKER_BUILDKIT: 1

create_release:
name: Create Release
create_debug:
name: Create debug
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' # Ensure this only runs on a tag or expect issues
needs:
Expand All @@ -353,39 +353,39 @@ jobs:
- name: Download Windows
uses: actions/download-artifact@v3
with:
name: release-windows-2022
name: debug-windows-2022
path: neolink_windows
- name: Download Macos
uses: actions/download-artifact@v3
with:
name: release-macos-12
name: debug-macos-12
path: neolink_macos
- name: Download Linux x86_64
uses: actions/download-artifact@v3
with:
name: release-ubuntu-22.04
name: debug-ubuntu-22.04
path: neolink_linux_x86_64_ubuntu
- name: Download Linux x86_64
uses: actions/download-artifact@v3
with:
name: release-amd64-bookworm
name: debug-amd64-bookworm
path: neolink_linux_x86_64_bookworm
- name: Download Linux armhf
uses: actions/download-artifact@v3
with:
name: release-armhf-bookworm
name: debug-armhf-bookworm
path: neolink_linux_armhf
- name: Download Linux arm64
uses: actions/download-artifact@v3
with:
name: release-arm64-bookworm
name: debug-arm64-bookworm
path: neolink_linux_arm64
- name: Download Linux i386
uses: actions/download-artifact@v3
with:
name: release-i386-bookworm
name: debug-i386-bookworm
path: neolink_linux_i386
- name: Prepare Releases
- name: Prepare debugs
run: |
dirs=(
neolink_windows
Expand All @@ -400,8 +400,8 @@ jobs:
chmod +x "${d}/neolink"*
zip -r "${d}.zip" "${d}"
done
- name: Release
uses: softprops/action-gh-release@v1
- name: debug
uses: softprops/action-gh-debug@v1
with:
name: Neolink ${{steps.toml.outputs.version}}
files: |
Expand All @@ -413,6 +413,6 @@ jobs:
neolink_linux_arm64.zip
neolink_linux_i386.zip
body: |
Neolink Release ${{steps.toml.outputs.version}}
Neolink debug ${{steps.toml.outputs.version}}
draft: true
prerelease: ${{ contains(github.ref_name, 'rc') }}
predebug: ${{ contains(github.ref_name, 'rc') }}
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ COPY . /usr/local/src/neolink

# Build the main program or copy from artifact
#
# We prefer building from artifact to reduce
# We prefer copying from artifact to reduce
# build time on the github runners
#
# Because of this through, during normal
# Because of this though, during normal
# github runner ops we are not testing the
# docker to see if it will build from scratch
# so if it is failing please make a PR
Expand Down Expand Up @@ -70,7 +70,8 @@ RUN apt-get update && \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-libav && \
gstreamer1.0-libav \
valgrind && \
apt-get clean -y && rm -rf /var/lib/apt/lists/*

COPY --from=build \
Expand All @@ -81,10 +82,12 @@ COPY docker/entrypoint.sh /entrypoint.sh
RUN gst-inspect-1.0; \
chmod +x "/usr/local/bin/neolink" && \
"/usr/local/bin/neolink" --version && \
mkdir -m 0700 /root/.config/ # Location that the push notifications are cached to
mkdir -m 0700 /root/.config/ && \
mkdir -m 0700 /valgrind/


ENV NEO_LINK_MODE="rtsp" NEO_LINK_PORT=8554

CMD /usr/local/bin/neolink ${NEO_LINK_MODE} --config /etc/neolink.toml
CMD valgrind --tool=massif --massif-out-file=/valgrind/massif.out /usr/local/bin/neolink ${NEO_LINK_MODE} --config /etc/neolink.toml
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE ${NEO_LINK_PORT}
2 changes: 2 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ exit_func() {
}
trap exit_func TERM INT

ulimit -n 1024

"$@"

0 comments on commit 31048ed

Please sign in to comment.