diff --git a/.github/workflows/container-example.yml b/.github/workflows/container-example.yml index 7c7cd6f..c3966dc 100644 --- a/.github/workflows/container-example.yml +++ b/.github/workflows/container-example.yml @@ -35,6 +35,7 @@ jobs: cd $EXNAME docker pull --platform=${{ matrix.platformarch}} alpine:$alpinetag docker save -o alpine.tar alpine:$alpinetag - docker build --no-cache --tag $imagetag --output build . + docker build --no-cache --tag $imagetag --build-arg ARCH=${{ matrix.arch }} . + docker cp $(docker create $imagetag):/opt/app ./build cd .. docker image rm -f $imagetag diff --git a/container-example/Dockerfile b/container-example/Dockerfile index 20ded43..dbd45b7 100644 --- a/container-example/Dockerfile +++ b/container-example/Dockerfile @@ -5,7 +5,7 @@ ARG VERSION=1.14 ARG UBUNTU_VERSION=22.04 ARG REPO=axisecp -FROM ${REPO}/acap-native-sdk:${VERSION}-${ARCH}-ubuntu${UBUNTU_VERSION} AS build +FROM ${REPO}/acap-native-sdk:${VERSION}-${ARCH}-ubuntu${UBUNTU_VERSION} ARG ARCH COPY ./* /opt/app/ @@ -16,7 +16,3 @@ RUN < [!NOTE] +> +> Depending on the network you are connected to, you may need to add proxy settings. +> The file that needs these settings is: `~/.docker/config.json`. For reference please see +> https://docs.docker.com/network/proxy and a +> [script for Axis devices](https://axiscommunications.github.io/acap-documentation/docs/develop/build-install-run.html#configure-network-proxy-settings) in the ACAP documentation. -Navigate to the root directory of this repository and then start with setting environment variables: +##### Build the application for armv7hf -```sh -export ARCH="aarch64" -export PLATFORM="linux/arm64/v8" -``` - -Next, pull the [Alpine linux container image][alpine] for aarch64 and save it to a .tar file: +Pull the [Alpine linux container image][alpine] for armv7hf and save it to a +.tar file, then build the application: ```sh -docker pull --platform=$PLATFORM alpine:3.19.1 +docker pull --platform="linux/arm/v7" alpine:3.19.1 docker save -o alpine.tar alpine:3.19.1 +docker build --build-arg ARCH=armv7hf --tag container-example:armv7hf . +docker cp $(docker create container-example:armv7hf):/opt/app ./build-armv7hf ``` -Finally build the application and extract the .eap file: +##### Build the application for aarch64 + +Pull the [Alpine linux container image][alpine] for aarch64 and save it to a +.tar file, then build the application: ```sh -docker buildx build --build-arg ARCH=$ARCH --output build-$ARCH . +docker pull --platform="linux/arm64/v8" alpine:3.19.1 +docker save -o alpine.tar alpine:3.19.1 +docker build --build-arg ARCH=aarch64 --tag container-example:aarch64 . +docker cp $(docker create container-example:aarch64):/opt/app ./build-aarch64 ``` -The .eap file can now be found in the `build-aarch64` folder. +##### Extract the application -## Install the application +The `build-armv7hf` and `build-aarch64` directories contain the build +artifacts, where the ACAP application is found with suffix `.eap`, depending on +which SDK architecture that was chosen, one of these files should be found: -On your Axis device, navigate to `http:///camera/index.html#/apps`, where -is the IP of your device. Make sure that the [Docker Compose ACAP][docker-compose-acap] application -is installed and running. In the settings of that application `IPCSocket` must be set to `yes`. -`TCPSocket` can be set to `no` since this example does not connect to the Docker Daemon from outside -of the device. However, if you do want to run with TCP Socket, TLS should be use (`UseTLS` set to `yes`). -In that case, follow the instructions in the [Docker Compose ACAP][docker-compose-acap] for how to -generate and upload TLS certificates to the device. For the other settings refer to the documentation -in that repo. +- `Container_Example_1_0_0_aarch64.eap` +- `Container_Example_1_0_0_armv7hf.eap` -Click on the `+Add app` button on the page and in the popup window that appears, select the .eap-file -that was built earlier. +#### Install your application -Alternatively, you can use `upload.cgi` in the [VAPIX Application API][VAPIX-application] to directly -upload the .eap-file from command line. +Browse to the application page of the Axis device: -## Run the application +```sh +http:///#settings/apps +``` -Start the application and then use a web browser to browse to +- Click on the tab `App` in the device GUI +- Click `(+)` sign to upload the application file +- Browse to the newly built ACAP application, depending on architecture: + - `Container_Example_1_0_0_aarch64.eap` + - `Container_Example_1_0_0_armv7hf.eap` +- Click `Install` +- Run the application by enabling the `Start` switch -```html -http://:8080 -``` +#### The expected output -The page should display the text "Hello from an ACAP!" +Browse to `http://:8080`, the page should display the text +**Hello from an ACAP!**. ## License @@ -127,5 +161,4 @@ The page should display the text "Hello from an ACAP!" [alpine]: https://hub.docker.com/_/alpine [docker-compose-acap]: https://github.com/AxisCommunications/docker-compose-acap [nc-man]: https://www.commandlinux.com/man-page/man1/nc.1.html -[VAPIX-application]: https://www.axis.com/vapix-library/subjects/T10102231/section/t10062344/display \ No newline at end of file