Skip to content

Commit

Permalink
Update dockerfile config and docker build process (#32)
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Sundberg <seansund@us.ibm.com>
  • Loading branch information
seansund authored Aug 27, 2024
1 parent 1390c77 commit ca3dd89
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
32 changes: 23 additions & 9 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,29 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
type: [nginx, express]

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Login to CNTK Quay
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_CNTK_USERNAME }}
Expand All @@ -51,6 +55,15 @@ jobs:
RELEASE_TAG="main"
fi
if [[ "${{ matrix.type }}" == "nginx" ]]; then
DEFAULT_IMAGE="true"
else
DEFAULT_IMAGE="false"
fi
echo "Default image: ${DEFAULT_IMAGE}"
echo "default-image=${DEFAULT_IMAGE}" >> $GITHUB_OUTPUT
echo "Release tag: ${RELEASE_TAG}"
echo "release-tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
Expand All @@ -62,21 +75,22 @@ jobs:
- name: Docker CNTK meta
id: cntk-meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{vars.IMAGE_BASE}}
${{ vars.IMAGE_BASE }},enable=${{ steps.variables.outputs.default-image }}
${{ vars.IMAGE_BASE }}-${{ matrix.type }}
# Docker tags based on the following events/attributes
tags: |
type=raw,value=${{ steps.variables.outputs.release-tag }},enable=${{ steps.variables.outputs.release-tag-enabled }}
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
file: Dockerfile-${{ matrix.type }}
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.cntk-meta.outputs.tags }}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi9/nodejs-18:1-70.1695740477
FROM registry.access.redhat.com/ubi9/nodejs-18:1-118.1724037695

WORKDIR /opt/app-root/src

Expand Down
8 changes: 4 additions & 4 deletions Dockerfile-express
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
FROM registry.access.redhat.com/ubi9/nodejs-18:1-70.1695740477 AS builder
FROM registry.access.redhat.com/ubi9/nodejs-18:1-118.1724037695 AS builder

WORKDIR /opt/app-root/src

COPY --chown=default:root . .

RUN mkdir -p /opt/app-root/src/node_modules && \
ls -lA && \
npm ci && \
npm run build

FROM registry.access.redhat.com/ubi9/nodejs-18:1-70.1695740477
FROM registry.access.redhat.com/ubi9/nodejs-18:1-118.1724037695

WORKDIR /opt/app-root/src

Expand All @@ -20,7 +19,8 @@ WORKDIR /opt/app-root/src/server
COPY --chown=default:root ./server/* .

RUN npm ci && \
chown -R 1001:root /opt/app-root/src/.npm
chown -R default:root /opt/app-root/src/.npm && \
chmod -R +w /opt/app-root/src/.npm

EXPOSE 8080

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile-nginx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi9/nodejs-18:1-70.1695740477 AS builder
FROM registry.access.redhat.com/ubi9/nodejs-18:1-118.1724037695 as builder

Check warning on line 1 in Dockerfile-nginx

View workflow job for this annotation

GitHub Actions / build (nginx)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

WORKDIR /opt/app-root/src

Expand All @@ -9,7 +9,7 @@ RUN mkdir -p /opt/app-root/src/node_modules && \
npm ci && \
npm run build

FROM registry.access.redhat.com/ubi9/nginx-122:1-31
FROM registry.access.redhat.com/ubi9/nginx-122:1-79.1724037698

WORKDIR /opt/app-root/src

Expand Down

0 comments on commit ca3dd89

Please sign in to comment.