Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
wip: test multi-arch build
Browse files Browse the repository at this point in the history
Signed-off-by: Chaz Leong <13462818+cleong14@users.noreply.github.com>
  • Loading branch information
cleong14 committed Jul 19, 2024
1 parent 3dfd966 commit f4f0262
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 29 deletions.
8 changes: 8 additions & 0 deletions angular-ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
FROM artifactory.cloud.cms.gov/batcave-docker/node:18-alpine AS base

WORKDIR /app

RUN apk add --no-cache make python3 g++

COPY package*.json .

RUN npm ci && npm cache clean --force


FROM base AS build

COPY . .

RUN npm run build


FROM artifactory.cloud.cms.gov/batcave-docker/node:18-alpine

WORKDIR /app

EXPOSE 4200
EXPOSE 8888

USER node

COPY --chown=node:node --from=build /app /app

CMD ["npm", "run", "start", "--", "--host", "0.0.0.0"]
66 changes: 37 additions & 29 deletions angular-ui/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ pipeline {
string(name: 'platform', defaultValue: 'linux/amd64', description: 'A comma separated list of platforms to build the container image for (e.g., linux/amd64,linux/arm64).')
}

agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
restartPolicy: Never
containers:
- name: build-amd64
image: artifactory.cloud.cms.gov/batcave-docker/node:18-alpine
command: ['tail', '-f', '/dev/null']
- name: build-arm64
image: artifactory.cloud.cms.gov/batcave-docker/node:18-alpine
command: ['tail', '-f', '/dev/null']
"""
}
}
agent none

stages {
stage('Build linux/amd64') {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
restartPolicy: Never
containers:
- name: build-amd64
image: artifactory.cloud.cms.gov/batcave-docker/node:18-alpine
command: ['tail', '-f', '/dev/null']
"""
}
label 'linux && x86_64'
}
when {
beforeAgent true
expression { params.platform.contains('linux/amd64') }
}
steps {
Expand All @@ -36,7 +36,23 @@ pipeline {
}

stage('Build linux/arm64') {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
restartPolicy: Never
containers:
- name: build-arm64
image: artifactory.cloud.cms.gov/batcave-docker/node:18-alpine
command: ['tail', '-f', '/dev/null']
"""
}
label 'linux && aarch64'
}
when {
beforeAgent true
expression { params.platform.contains('linux/arm64') }
}
steps {
Expand All @@ -49,9 +65,7 @@ pipeline {
}

stage('Test linux/amd64') {
when {
expression { params.platform.contains('linux/amd64') }
}
agent { label 'linux && x86_64' }
parallel {
stage('Unit Test') {
steps {
Expand Down Expand Up @@ -93,9 +107,7 @@ pipeline {
}

stage('Test linux/arm64') {
when {
expression { params.platform.contains('linux/arm64') }
}
agent { label 'linux && aarch64' }
parallel {
stage('Unit Test') {
steps {
Expand Down Expand Up @@ -137,9 +149,7 @@ pipeline {
}

stage('Delivery linux/amd64') {
when {
expression { params.platform.contains('linux/amd64') }
}
agent { label 'linux && x86_64' }
steps {
build(job: 'Angular UI Delivery', wait: true, propagate: true, parameters: [
string(name: 'tag', value: "${GIT_COMMIT[0..7]}"),
Expand All @@ -153,9 +163,7 @@ pipeline {
}

stage('Delivery linux/arm64') {
when {
expression { params.platform.contains('linux/arm64') }
}
agent { label 'linux && aarch64' }
steps {
build(job: 'Angular UI Delivery', wait: true, propagate: true, parameters: [
string(name: 'tag', value: "${GIT_COMMIT[0..7]}"),
Expand Down

0 comments on commit f4f0262

Please sign in to comment.