Skip to content

Commit 9017f98

Browse files
authored
Test: container image workflow (#792)
* test: Container image workflow and dockerfile * test: test build container image workflow * test: Test build container image workflow - authorization fixed * test: Test build container image workflow - remove dummy job * test: delete Test build container image workflow
1 parent dcc8287 commit 9017f98

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

.github/workflows/container-image.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: container-image-build
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
image_tag:
7+
type: string
8+
default: ${{ github.event.number }}
9+
outputs:
10+
image:
11+
description: The resulting image link
12+
value: ${{ jobs.build-docker-image.outputs.image }}
13+
14+
workflow_dispatch:
15+
16+
jobs:
17+
build-docker-image:
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest]
21+
runs-on: ${{ matrix.os }}
22+
timeout-minutes: 60
23+
24+
name: docker-build-${{ matrix.os }}
25+
outputs:
26+
image: ${{ steps.build.outputs.image }}
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v3
30+
31+
- name: Build image
32+
id: build
33+
run: |
34+
35+
SHORT_REF=$(git rev-parse --short HEAD)
36+
37+
TAG=$([ "${PR_NUMBER}" == "" ] && echo "${SHORT_REF}" || echo "${PR_NUMBER}")
38+
IMAGE=quay.io/wakuorg/go-waku-pr:${TAG}
39+
40+
echo "image=${IMAGE}" >> $GITHUB_OUTPUT
41+
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
42+
43+
docker login -u ${QUAY_USER} -p ${QUAY_PASSWORD} quay.io
44+
docker build -t ${IMAGE} -f docker/Dockerfile.test.amd64 --label quay.expires-after=7d .
45+
docker push ${IMAGE}
46+
env:
47+
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
48+
QUAY_USER: ${{ secrets.QUAY_USER }}
49+
PR_NUMBER: ${{ inputs.image_tag }}
50+

docker/Dockerfile.test.amd64

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# BUILD IMAGE --------------------------------------------------------
2+
FROM golang:1.20 as builder
3+
4+
WORKDIR /app
5+
COPY . .
6+
7+
# Build the final node binary
8+
RUN make -j$(nproc) build
9+
10+
# ACTUAL IMAGE -------------------------------------------------------
11+
12+
FROM debian:12.1-slim
13+
14+
LABEL maintainer="romanzac@status.im"
15+
LABEL source="https://github.com/waku-org/go-waku"
16+
LABEL description="go-waku: Waku V2 node - test"
17+
18+
# color, nocolor, json
19+
ENV GOLOG_LOG_FMT=nocolor
20+
21+
RUN apt update && apt install -y ca-certificates
22+
23+
# go-waku default ports
24+
EXPOSE 9000 30303 60000 60001 8008 8009
25+
26+
COPY --from=builder /app/build/waku /usr/bin/waku
27+
28+
ENTRYPOINT ["/usr/bin/waku"]
29+
# By default just show help if called without arguments
30+
CMD ["--help"]

0 commit comments

Comments
 (0)