Skip to content

Commit 0160343

Browse files
Trent/image ci (#25)
Co-authored-by: nicholas-codecov <nicholas.deschenes@sentry.io>
1 parent 7fcb70b commit 0160343

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

.github/workflows/test-api-ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test API Image CI
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- integration-tests/test-api/**
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
13+
jobs:
14+
build:
15+
name: Build API Test
16+
uses: codecov/gha-workflows/.github/workflows/build-and-push-dockerhub.yml@v1.2.14
17+
secrets: inherit
18+
with:
19+
push: false
20+
image_name: codecov-javascript-bundler-plugins-test-api
21+
docker_path: integration-tests/test-api

.github/workflows/test-api-push.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test API Image Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- integration-tests/test-api/**
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
12+
cancel-in-progress: true
13+
14+
15+
jobs:
16+
push:
17+
name: Push API Test
18+
if: github.repository_owner == 'codecov'
19+
uses: codecov/gha-workflows/.github/workflows/build-and-push-dockerhub.yml@v1.2.14
20+
secrets: inherit
21+
with:
22+
push: true
23+
image_name: codecov-javascript-bundler-plugins-test-api
24+
docker_path: integration-tests/test-api

Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
DOCKERHUB_REPO ?= codecov
2+
IMAGE_NAME ?= codecov-javascript-bundler-plugins-test-api
3+
DOCKER_PATH ?= integration-tests/test-api
4+
OS_NAME := $(shell uname -s | tr A-Z a-z)
5+
build_date := $(shell git show -s --date=iso8601-strict --pretty=format:%cd $$sha)
6+
BUILD_PLATFORM := $(shell docker system info --format '{{.OSType}}/{{.Architecture}}')
7+
sha := $(shell git rev-parse --short=7 HEAD)
8+
dockerhub_image := ${DOCKERHUB_REPO}/${IMAGE_NAME}
9+
export DOCKER_BUILDKIT := 1
10+
11+
build.${IMAGE_NAME}:
12+
docker build -f ${DOCKER_PATH}/Dockerfile ${DOCKER_PATH} -t ${dockerhub_image}:latest \
13+
-t ${dockerhub_image}:${sha} \
14+
--label "org.label-schema.build-date"="$(build_date)" \
15+
--label "org.label-schema.name"="${IMAGE_NAME}" \
16+
--label "org.label-schema.vendor"="Codecov" \
17+
--label "org.label-schema.version"="${sha}" \
18+
--build-arg BUILDPLATFORM=${BUILD_PLATFORM}
19+
20+
tag.${IMAGE_NAME}:
21+
docker tag ${dockerhub_image}:${sha} ${dockerhub_image}:latest
22+
23+
push.${IMAGE_NAME}:
24+
docker push ${dockerhub_image}:latest
25+
docker push ${dockerhub_image}:${sha}
26+
27+
save.${IMAGE_NAME}:
28+
docker save -o ${IMAGE_NAME}.tar ${dockerhub_image}:${sha}

integration-tests/test-api/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM --platform=arm64 node:20-alpine
1+
# syntax=docker/dockerfile:1
2+
ARG BUILDPLATFORM=arm64
3+
FROM --platform=$BUILDPLATFORM node:20-alpine
24
WORKDIR /app
35

46
ENV NODE_ENV=production

0 commit comments

Comments
 (0)