Skip to content

Commit

Permalink
Save artifact apks to the docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
jptomoya committed Dec 3, 2023
1 parent afe208f commit 1de25bc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ RUN abuild-keygen -a -i -n \

FROM alpine:${ALPINE_VERSION}
COPY --from=builder --chown=root:root /home/packager/.abuild/*.pub /etc/apk/keys
COPY --from=builder --chown=root:root /home/packager/packages /root/packages
RUN CHROMIUM_APK=$(find /root/packages/community/x86_64/ -name 'chromium-*.apk' -type f | sort -n | head -n 1) \
WORKDIR /opt/packages
COPY --from=builder --chown=root:root /home/packager/packages .
RUN CHROMIUM_APK=$(find ./community/x86_64/ -name 'chromium-*.apk' -type f | sort -n | head -n 1) \

Check failure on line 27 in Dockerfile

View workflow job for this annotation

GitHub Actions / Run Hadolint

DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`

Check failure on line 27 in Dockerfile

View workflow job for this annotation

GitHub Actions / Run Hadolint

DL4006 warning: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check
&& [ -n "$CHROMIUM_APK" ] \
&& apk add --no-cache "${CHROMIUM_APK}" font-noto-cjk \
&& rm -rf /root/packages \
&& adduser -D user

WORKDIR /
USER user
9 changes: 6 additions & 3 deletions Dockerfile.wsnapshot
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ RUN abuild-keygen -a -i -n \

FROM alpine:${ALPINE_VERSION}
COPY --from=builder --chown=root:root /home/packager/.abuild/*.pub /etc/apk/keys
COPY --from=builder --chown=root:root /home/packager/packages /root/packages
RUN CHROMIUM_APK=$(find /root/packages/community/x86_64/ -name 'chromium-*.apk' -type f | sort -n | head -n 1) \
WORKDIR /opt/packages
COPY --from=builder --chown=root:root /home/packager/packages .
RUN CHROMIUM_APK=$(find ./community/x86_64/ -name 'chromium-*.apk' -type f | sort -n | head -n 1) \

Check failure on line 48 in Dockerfile.wsnapshot

View workflow job for this annotation

GitHub Actions / Run Hadolint

DL4006 warning: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check

Check failure on line 48 in Dockerfile.wsnapshot

View workflow job for this annotation

GitHub Actions / Run Hadolint

DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
&& [ -n "$CHROMIUM_APK" ] \
&& apk add --no-cache "${CHROMIUM_APK}" font-noto-cjk \
&& rm -rf /root/packages \
&& adduser -D user

WORKDIR /
USER user
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,19 @@ docker run -d --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY \
--cap-add SYS_ADMIN abuild-chromium chromium --disable-gpu --disable-dev-shm-usage --no-first-run
```

* the SYS_ADMIN capability required to run Chromium.
* the `SYS_ADMIN` capability required to run Chromium.
* Use `--disable-dev-shm-usage` because Docker's /dev/shm is usually too small.

## Extracting apk and public key
To extract the built Chromium apk and the corresponding public key for installation on other Alpine Linux environments, follow these steps:

```
$ container_id=$(docker run --rm -d abuild-chromium tail -f /dev/null)
$ docker cp $container_id:/opt/packages .
$ docker cp $container_id:/etc/apk/keys/ .
$ docker kill $container_id
```

![image](https://github.com/jptomoya/abuild-chromium/assets/4786564/c8d6cb68-7dd1-4481-a04c-b6b26c53e433)

## References
Expand Down

0 comments on commit 1de25bc

Please sign in to comment.