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
This commit is contained in:
Roman Zajic 2023-10-05 08:34:36 +08:00 committed by GitHub
parent dcc828749f
commit 9017f9816a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 80 additions and 0 deletions

50
.github/workflows/container-image.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: container-image-build
on:
workflow_call:
inputs:
image_tag:
type: string
default: ${{ github.event.number }}
outputs:
image:
description: The resulting image link
value: ${{ jobs.build-docker-image.outputs.image }}
workflow_dispatch:
jobs:
build-docker-image:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
name: docker-build-${{ matrix.os }}
outputs:
image: ${{ steps.build.outputs.image }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build image
id: build
run: |
SHORT_REF=$(git rev-parse --short HEAD)
TAG=$([ "${PR_NUMBER}" == "" ] && echo "${SHORT_REF}" || echo "${PR_NUMBER}")
IMAGE=quay.io/wakuorg/go-waku-pr:${TAG}
echo "image=${IMAGE}" >> $GITHUB_OUTPUT
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
docker login -u ${QUAY_USER} -p ${QUAY_PASSWORD} quay.io
docker build -t ${IMAGE} -f docker/Dockerfile.test.amd64 --label quay.expires-after=7d .
docker push ${IMAGE}
env:
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
QUAY_USER: ${{ secrets.QUAY_USER }}
PR_NUMBER: ${{ inputs.image_tag }}

View File

@ -0,0 +1,30 @@
# BUILD IMAGE --------------------------------------------------------
FROM golang:1.20 as builder
WORKDIR /app
COPY . .
# Build the final node binary
RUN make -j$(nproc) build
# ACTUAL IMAGE -------------------------------------------------------
FROM debian:12.1-slim
LABEL maintainer="romanzac@status.im"
LABEL source="https://github.com/waku-org/go-waku"
LABEL description="go-waku: Waku V2 node - test"
# color, nocolor, json
ENV GOLOG_LOG_FMT=nocolor
RUN apt update && apt install -y ca-certificates
# go-waku default ports
EXPOSE 9000 30303 60000 60001 8008 8009
COPY --from=builder /app/build/waku /usr/bin/waku
ENTRYPOINT ["/usr/bin/waku"]
# By default just show help if called without arguments
CMD ["--help"]