Skip to content

Commit

Permalink
[docker] remove (redundant) chmod and testable workflows (#1710)
Browse files Browse the repository at this point in the history
## Description
* Removes the redundant `chown` from step 12, relying on the final one
in step 20.
* Adds new workflow inputs
  * guild_deploy_branch which defaults to master
  * testing which defaults to false
* Conditional logic on the push operation
  * If branch is master and testing is false, the push will occur.
  * If branch is master but testing is true, the push will not occur
* If branch is NOT master, but testing is falase, the push will not
occur (prevents mistaken test from updating the public images).

## Where should the reviewer start?
Compare the two builds. Try a workflow dispatch with testing true, and
with branch not set to master.

## Motivation and context
An error in build process when no shell scripts exist in
`/home/guild/.scripts/` when the operation occurs. Allows testing of the
branches for docker building similar to pre-merge testing of changes to
guild-deploy.sh etc.

## Which issue it fixes?
Closes #1709

## How has this been tested?
Local build, and [workflow
job](https://github.com/cardano-community/guild-operators/actions/runs/6996999037/job/19033480048)
  • Loading branch information
TrevorBenson authored Nov 27, 2023
1 parent 2349b04 commit 30704c1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/docker_bin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ name: Docker Image

on:
workflow_dispatch:
inputs:
guild_deploy_branch:
description: Branch to deploy
required: false
default: master
testing:
description: Testing workflow
required: false
type: boolean
default: false
push:
paths:
- 'files/docker/node/release-versions/cardano-node-latest.txt'
Expand All @@ -26,6 +36,7 @@ jobs:
--file files/docker/node/dockerfile_bin \
--compress \
--build-arg G_ACCOUNT=${{ env.G_ACCOUNT }} \
--build-arg GUILD_DEPLOY_BRANCH=${{ env.guild_deploy_branch }} \
--tag ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:latest
# Workaround to provide additional free space for builds.
# https://github.com/actions/virtual-environments/issues/2840
Expand All @@ -42,6 +53,7 @@ jobs:
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: docker push latest
if: env.testing == 'false' && env.guild_deploy_branch == 'master'
run: |
CNVERSION=`cat files/docker/node/release-versions/cardano-node-latest.txt`
docker push ${{ env.REGISTRY }}/${{ secrets.DOCKER_USER }}/cardano-node:latest
Expand Down
8 changes: 4 additions & 4 deletions files/docker/node/dockerfile_bin
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ STOPSIGNAL SIGINT
LABEL desc="Cardano Node by Guild's Operators"
ARG DEBIAN_FRONTEND=noninteractive
ARG G_ACCOUNT
ARG GUILD_DEPLOY_BRANCH

USER root
WORKDIR /
Expand Down Expand Up @@ -45,7 +46,7 @@ RUN set -x && apt update \
&& export SUDO='N' \
&& export UPDATE_CHECK='N' \
&& export SKIP_DBSYNC_DOWNLOAD='Y' \
&& chmod +x ./guild-deploy.sh && ./guild-deploy.sh -b master -s p \
&& chmod +x ./guild-deploy.sh && ./guild-deploy.sh -b ${GUILD_DEPLOY_BRANCH} -s p \
&& ls /opt/ \
&& mkdir -p $CNODE_HOME/priv/files \
&& apt-get -y remove libpq-dev build-essential pkg-config libffi-dev libgmp-dev libssl-dev libtinfo-dev libsystemd-dev zlib1g-dev make g++ \
Expand All @@ -58,14 +59,13 @@ RUN set -x && apt update \
RUN set -x && export SUDO='N' \
&& export UPDATE_CHECK='N' \
&& export SKIP_DBSYNC_DOWNLOAD='Y' \
&& ./guild-deploy.sh -b master -s dcmowx \
&& ./guild-deploy.sh -b ${GUILD_DEPLOY_BRANCH} -s dcmowx \
&& cd /usr/bin \
&& wget http://www.vdberg.org/~richard/tcpping \
&& chmod 755 tcpping \
&& chown -R guild:guild $CNODE_HOME \
&& mv /root/.local/bin /home/guild/.local/ \
&& chown -R guild:guild /home/guild/.* \
&& chmod a+x /home/guild/.scripts/*.sh /opt/cardano/cnode/scripts/*.sh
&& chown -R guild:guild /home/guild/.*

# Add final tools in a separate layer to shrink the largest layer
RUN apt-get update \
Expand Down

0 comments on commit 30704c1

Please sign in to comment.