Skip to content

Commit 427341d

Browse files
committed
creating actions to publish HPCS server image
1 parent 80716ee commit 427341d

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish server docker image
2+
on: [push]
3+
4+
env:
5+
IMAGE_NAME: hpcs/server
6+
7+
jobs:
8+
push:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
packages: write
12+
contents: read
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Build image
17+
run: docker build . -f ./server/Dockerfile -t $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
18+
19+
- name: Log in to registry
20+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
21+
22+
- name: Push image
23+
run: |
24+
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
25+
26+
# This changes all uppercase characters to lowercase.
27+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
28+
29+
# This strips the git ref prefix from the version.
30+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
31+
32+
# This strips the "v" prefix from the tag name.
33+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
34+
35+
# This uses the Docker `latest` tag convention.
36+
[ "$VERSION" == "main" ] && VERSION=latest
37+
echo IMAGE_ID=$IMAGE_ID
38+
echo VERSION=$VERSION
39+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
40+
docker push $IMAGE_ID:$VERSION

server/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RUN apk add \
1010
RUN wget -q https://github.com/spiffe/spire/releases/download/v1.9.0/spire-1.9.0-linux-amd64-musl.tar.gz
1111
RUN tar xvf spire-1.9.0-linux-amd64-musl.tar.gz ; mv spire-1.9.0 /opt ; mv /opt/spire-1.9.0 /opt/spire
1212
RUN ln -s /opt/spire/bin/spire-agent /usr/bin/spire-agent
13+
RUN ln -s /opt/spire/bin/spire-server /usr/bin/spire-server
1314

1415
# Install pyspiffe package
1516
RUN pip install git+https://github.com/HewlettPackard/py-spiffe.git

0 commit comments

Comments
 (0)