Skip to content

Commit

Permalink
test new dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Silvija Tovernic committed Sep 21, 2024
1 parent ef2c6e5 commit df83dd4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
10 changes: 3 additions & 7 deletions images/docker/image-factory-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,16 @@ RUN groupadd -r ${USER_GROUP} && \
mkdir -p ${USER_HOME}/.local/share/containers && \
chown -R ${USER_NAME}:${USER_GROUP} ${USER_HOME}

# Add podman configuration files
COPY files/containers.conf ${USER_HOME}/.config/containers/containers.conf
COPY files/registries.conf ${USER_HOME}/.config/containers/registries.conf

# Setup for rootless podman
# referrence: https://github.com/containers/podman/issues/2788#issuecomment-1016301663
RUN usermod --add-subuids 100000-165535 --add-subgids 100000-165535 ${USER_NAME} && \
chmod u-s /usr/bin/newuidmap /usr/bin/newgidmap && \
setcap cap_setuid+eip /usr/bin/newuidmap && \
setcap cap_setgid+eip /usr/bin/newgidmap

# QEMU setup
RUN update-binfmts --enable qemu-aarch64 && \
update-binfmts --enable qemu-arm
# # QEMU setup
# RUN update-binfmts --enable qemu-aarch64 && \
# update-binfmts --enable qemu-arm

# Change to runner workdir
WORKDIR ${USER_HOME}
Expand Down
13 changes: 11 additions & 2 deletions images/docker/image-factory-runner/scripts/start-github-runner.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

GITHUB_OWNER=$GITHUB_OWNER
GITHUB_REPOSITORY=$GITHUB_REPOSITORY
# GITHUB_OWNER=$GITHUB_OWNER
# GITHUB_REPOSITORY=$GITHUB_REPOSITORY
GITHUB_TOKEN=$(cat /.pat/.token)
GITHUB_RUNNER_NAME="if-runner-$(hostname)"
GITHUB_LABELS="wp10-image-factory"
Expand All @@ -11,6 +11,15 @@ podman login "$CONTAINER_REGISTRY" \
--username "$CONTAINER_REGISTRY_USERNAME" \
--password "$CONTAINER_REGISTRY_PASSWORD"

echo "Configure registries:"
cat <<EOF > $HOME/.config/containers/registries.conf
[registries]
registries = ["$CONTAINER_REGISTRY"]
[registries.search]
registries = ["$CONTAINER_REGISTRY"]
EOF

# REG_TOKEN Token will be available only during container startup
echo "Getting runner registration token from GitHub..."
REG_TOKEN=$(curl -sX POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/${GITHUB_OWNER}/${GITHUB_REPOSITORY}/actions/runners/registration-token | jq .token --raw-output)
Expand Down

0 comments on commit df83dd4

Please sign in to comment.