Skip to content

Commit 3152315

Browse files
author
mike dupont
committed
now using standard tagging
1 parent 61c9d58 commit 3152315

File tree

2 files changed

+81
-79
lines changed

2 files changed

+81
-79
lines changed

.github/workflows/image.yaml

+71-69
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,97 @@
1-
#
1+
22
name: Create and publish a Docker image
33

4-
# Configures this workflow to run every time a change is pushed to the branch called `release`.
54
on:
6-
#release:
7-
# types: [created]
85
workflow_dispatch:
96
push:
107
pull_request:
11-
#branch:
128

13-
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
149
env:
1510
REGISTRY: ghcr.io
1611
IMAGE_NAME: ${{ github.repository }}
1712

18-
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
1913
jobs:
2014

2115
build-and-push-image:
2216
runs-on: ubuntu-latest
23-
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
2417
permissions:
2518
contents: read
2619
packages: write
2720
attestations: write
2821
id-token: write
29-
#
22+
3023
steps:
31-
- name: Set up Docker Buildx
32-
uses: meta-introspector/setup-buildx-action@v3.8.0
33-
with:
34-
install: true
35-
platforms: linux/amd64,linux/arm/v7
36-
# first we login
37-
- name: Login to Docker Hub
38-
uses: meta-introspector/login-action@v3
39-
with:
40-
username: ${{ vars.DOCKER_HUB_USERNAME }}
41-
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
24+
- name: Configure AWS credentials
25+
uses: meta-introspector/configure-aws-credentials@v4
26+
with:
27+
aws-region: ${{ secrets.AWS_REGION || 'us-east-2'}}
28+
role-session-name: github-actions-${{ env.APP_NAME || 'eliza'}}
29+
# FIXME hard coded
30+
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID || '767503528736' }}:role/github
31+
32+
- name: Login to Amazon ECR
33+
id: login-ecr
34+
uses: meta-introspector/amazon-ecr-login@v1
35+
36+
- name: Set short sha
37+
id: sha_short
38+
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
39+
40+
41+
- name: Set up Docker Buildx
42+
uses: meta-introspector/setup-buildx-action@v3.8.0
43+
with:
44+
install: true
45+
platforms: linux/amd64,linux/arm/v7
46+
47+
- name: Login to Docker Hub
48+
uses: meta-introspector/login-action@v3
49+
with:
50+
username: ${{ vars.DOCKER_HUB_USERNAME }}
51+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
4252

43-
- name: Checkout repository
44-
uses: meta-introspector/checkout@v4
45-
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
46-
- name: Log in to the Container registry
47-
uses: meta-introspector/login-action@v3.0.0
48-
with:
49-
registry: ${{ env.REGISTRY }}
50-
username: ${{ github.actor }}
51-
password: ${{ secrets.GITHUB_TOKEN }}
52-
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
53-
- name: Extract metadata (tags, labels) for Docker
54-
id: meta
55-
uses: meta-introspector/metadata-action@v5.5.1
56-
with:
57-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
58-
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
59-
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
60-
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
61-
- name: Build and push Docker image
62-
id: push
63-
uses: meta-introspector/build-push-action@v5.0.0
64-
with:
65-
platforms: linux/arm64
66-
context: .
67-
push: true
68-
tags: ${{ steps.meta.outputs.tags }}
69-
labels: ${{ steps.meta.outputs.labels }}
53+
- name: Checkout repository
54+
uses: meta-introspector/checkout@v4
7055

71-
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
72-
- name: Generate artifact attestation
73-
uses: meta-introspector/attest-build-provenance@local
74-
with:
75-
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
76-
subject-digest: ${{ steps.push.outputs.digest }}
77-
push-to-registry: true
56+
- name: Log in to the Container registry
57+
uses: meta-introspector/login-action@v3.0.0
58+
with:
59+
registry: ${{ env.REGISTRY }}
60+
username: ${{ github.actor }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
7862

79-
# This step makes the Docker image public, so users can pull it without authentication.
80-
- name: Make Docker image public
81-
run: |
82-
curl \
83-
-X PATCH \
84-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
85-
-H "Accept: application/vnd.github.v3+json" \
86-
https://api.github.com/user/packages/container/${{ env.IMAGE_NAME }}/visibility \
87-
-d '{"visibility":"public"}'
63+
- name: Extract metadata (tags, labels) for Docker
64+
id: meta
65+
uses: meta-introspector/metadata-action@v5.5.1
66+
with:
67+
images: |
68+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
69+
h4ckermike/elizaos-eliza
70+
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY || 'agent/eliza'}}
71+
72+
- name: Build and push Docker image
73+
id: push
74+
uses: meta-introspector/build-push-action@v6.10.0
75+
with:
76+
platforms: linux/arm64
77+
context: .
78+
push: true
79+
tags: |
80+
${{ steps.meta.outputs.tags }}
81+
labels: ${{ steps.meta.outputs.labels }}
8882

83+
- name: Generate artifact attestation
84+
uses: meta-introspector/attest-build-provenance@local
85+
with:
86+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
87+
subject-digest: ${{ steps.push.outputs.digest }}
88+
push-to-registry: true
8989

90-
- name: Build and push Docker images
91-
uses: meta-introspector/build-push-action@v6.10.0
92-
with:
93-
push: true
94-
# FIXME add in better names for tag
95-
tags: h4ckermike/elizaos-eliza:micro
90+
- name: Make Docker image public
91+
run: |
92+
curl \
93+
-X PATCH \
94+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
95+
-H "Accept: application/vnd.github.v3+json" \
96+
https://api.github.com/user/packages/container/${{ env.IMAGE_NAME }}/visibility \
97+
-d '{"visibility":"public"}'

Dockerfile

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
# note this architecture is listed twice in this file!
44
FROM arm64v8/node:23-bookworm-slim AS builder
55

6+
RUN apt-get update
7+
RUN apt-get install -y bash
8+
RUN apt-get install -y curl python3
9+
610
# Install pnpm globally and install necessary build tools
7-
RUN npm install -g pnpm@9.4.0 && \
8-
apt-get update && \
9-
apt-get install -y git python3 make g++ && \
10-
apt-get clean && \
11-
rm -rf /var/lib/apt/lists/*
11+
RUN npm install -g pnpm@9.4.0
1212

1313
# Set Python 3 as the default python
1414
RUN ln -s /usr/bin/python3 /usr/bin/python
@@ -35,11 +35,11 @@ RUN pnpm install \
3535
FROM arm64v8/node:23-bookworm-slim
3636

3737
# Install runtime dependencies if needed
38-
RUN npm install -g pnpm@9.4.0 && \
39-
apt-get update && \
40-
apt-get install -y git python3 curl && \
41-
apt-get clean && \
42-
rm -rf /var/lib/apt/lists/*
38+
RUN apt-get update
39+
RUN apt-get install -y bash
40+
RUN apt-get install -y git python3 curl
41+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
42+
RUN npm install -g pnpm@9.4.0
4343

4444
WORKDIR /app
4545

0 commit comments

Comments
 (0)