Skip to content

Commit 5ce6062

Browse files
author
Sean Sundberg
authored
Adds workflow to build image and push to quay (#319)
Signed-off-by: Sean Sundberg <seansund@us.ibm.com>
1 parent 6ec2fdb commit 5ce6062

File tree

2 files changed

+66
-2
lines changed

2 files changed

+66
-2
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Docker build
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
push:
8+
branches:
9+
- main
10+
- beta
11+
12+
jobs:
13+
docker:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Set up tags
17+
id: setup
18+
run: |
19+
TAG_BASE="quay.io/ibmgaragecloud/toolkit-guide"
20+
21+
BRANCH=${GITHUB_REF#refs/heads/}
22+
TAG="${{ github.event.release.tag_name }}"
23+
if [[ -n "${TAG}" ]]; then
24+
echo "Running against tag: ${TAG}"
25+
TAGS="${TAG_BASE}:${TAG}"
26+
else
27+
echo "Running against branch: ${BRANCH}"
28+
TAGS="${TAG_BASE}:${BRANCH}"
29+
if [[ "${BRANCH}" == "main" ]]; then
30+
TAGS="${TAGS},${TAG_BASE}:latest"
31+
fi
32+
fi
33+
34+
echo "::set-output name=tags::${TAGS}"
35+
36+
- name: Set up QEMU
37+
uses: docker/setup-qemu-action@v1
38+
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v1
41+
42+
- name: Login to DockerHub
43+
uses: docker/login-action@v1
44+
with:
45+
registry: docker.io
46+
username: ${{ secrets.DOCKER_USER }}
47+
password: ${{ secrets.DOCKER_TOKEN }}
48+
49+
- name: Login to Quay
50+
uses: docker/login-action@v1
51+
with:
52+
registry: quay.io
53+
username: ${{ secrets.QUAY_USERNAME }}
54+
password: ${{ secrets.QUAY_TOKEN }}
55+
56+
- name: Build and push
57+
id: docker_build
58+
uses: docker/build-push-action@v2
59+
with:
60+
push: true
61+
tags: ${{steps.setup.outputs.tags}}
62+
63+
- name: Image digest
64+
run: echo ${{ steps.docker_build.outputs.digest }}

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM quay.io/ibmgaragecloud/node:lts-stretch as builder
1+
FROM docker.io/node:lts-stretch as builder
22

33
RUN apt-get update && apt-get -y install libjemalloc1
44
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1
@@ -17,6 +17,6 @@ COPY --chown=1001:0 . .
1717

1818
RUN npm ci && npm run clean && npm run build
1919

20-
FROM quay.io/bitnami/nginx
20+
FROM docker.io/bitnami/nginx
2121

2222
COPY --from=builder /home/dev/app/public /app

0 commit comments

Comments
 (0)