diff --git a/.github/workflows/docker-arm-v6.yaml b/.github/workflows/docker-arm-v6.yaml new file mode 100644 index 00000000..07c6149d --- /dev/null +++ b/.github/workflows/docker-arm-v6.yaml @@ -0,0 +1,63 @@ +# A single-shot build-n-pack on Alpine Linux +name: Publish Docker image (ARM v6) +on: [push] + +jobs: + push_to_registry: + name: Build Docker image (ARM v6) + runs-on: ubuntu-latest + steps: + - name: Check token is set + id: vars + shell: bash + run: | + unset HAS_SECRET + if [ -n $SECRET ]; then HAS_SECRET='true' ; fi + echo ::set-output name=HAS_SECRET_TOKEN::${HAS_SECRET} + env: + SECRET: "${{ secrets.DOCKER_TOKEN }}" + - name: Check out the repo + uses: actions/checkout@v2 + if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} + - name: Convert username to lower case for docker + id: string_user + uses: ASzc/change-string-case-action@v1 + with: + string: ${{ github.repository_owner }} + - name: Convert repo to lower case for docker + id: string_repo + uses: ASzc/change-string-case-action@v1 + with: + string: ${{ github.repository }} + - name: Set up QEMU + if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} + uses: docker/setup-buildx-action@v1 + - name: Login to dockerhub + if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} + uses: docker/login-action@v1 + with: + username: ${{ steps.string_user.outputs.lowercase }} + password: ${{ secrets.DOCKER_TOKEN }} + - name: Get tag name + if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} + id: tags + run: | + branch="${GITHUB_REF#refs/heads/}" + tags="${REPO_NAME}:${branch}" + if [ "${branch}" == "master" ]; then + tags="${tags},${REPO_NAME}:latest" + fi + echo "::set-output name=TAGS::${tags}" + env: + REPO_NAME: ${{ steps.string_repo.outputs.lowercase }} + - name: Push to Docker Hub Debian + if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} + uses: docker/build-push-action@v2 + with: + platforms: linux/arm/v6 + push: true + file: Dockerfile + tags: ${{ steps.tags.outputs.TAGS }} diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index a6393157..668d706b 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -29,12 +29,35 @@ jobs: uses: ASzc/change-string-case-action@v1 with: string: ${{ github.repository }} - - name: Push to Docker Hub - uses: docker/build-push-action@v1 + - name: Set up QEMU if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} + uses: docker/setup-buildx-action@v1 + - name: Login to dockerhub + if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} + uses: docker/login-action@v1 with: username: ${{ steps.string_user.outputs.lowercase }} password: ${{ secrets.DOCKER_TOKEN }} - registry: docker.io - repository: ${{ steps.string_repo.outputs.lowercase }} - tag_with_ref: true + - name: Get tag name + if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} + id: tags + run: | + branch="${GITHUB_REF#refs/heads/}" + tags="${REPO_NAME}:${branch}" + if [ "${branch}" == "master" ]; then + tags="${tags},${REPO_NAME}:latest" + fi + echo "::set-output name=TAGS::${tags}" + env: + REPO_NAME: ${{ steps.string_repo.outputs.lowercase }} + - name: Push to Docker Hub Debian + if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }} + uses: docker/build-push-action@v2 + with: + platforms: linux/arm/v7,linux/arm64/v8,linux/amd64 + push: true + file: Dockerfile + tags: ${{ steps.tags.outputs.TAGS }} diff --git a/Dockerfile b/Dockerfile index e59a34a9..51566042 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,10 @@ # Copyright (c) 2020 George Hilliard # SPDX-License-Identifier: AGPL-3.0-only -FROM docker.io/rust:1-alpine AS build +FROM docker.io/alpine AS build MAINTAINER thirtythreeforty@gmail.com +RUN apk add rust cargo RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ gst-rtsp-server-dev RUN apk add --no-cache musl-dev gcc @@ -34,7 +35,9 @@ COPY --from=build \ /usr/local/src/neolink/target/release/neolink \ /usr/local/bin/neolink COPY docker/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh CMD ["/usr/local/bin/neolink", "--config", "/etc/neolink.toml"] ENTRYPOINT ["/entrypoint.sh"] -EXPOSE 8554 +EXPOSE 8554 +