fix: mount /apps and docker socket in PR workflow build-and-deploy-ci job #41
@@ -22,6 +22,21 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Compute dependency cache key
|
||||||
|
id: npm-key
|
||||||
|
run: |
|
||||||
|
echo "hash=$(sha256sum package-lock.json | cut -d' ' -f1)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache node_modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
node_modules
|
||||||
|
~/.npm
|
||||||
|
key: npm-${{ runner.os }}-${{ steps.npm-key.outputs.hash }}
|
||||||
|
restore-keys: |
|
||||||
|
npm-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci --legacy-peer-deps
|
run: npm ci --legacy-peer-deps
|
||||||
|
|
||||||
@@ -46,6 +61,21 @@ jobs:
|
|||||||
|
|
||||||
# Required for acceptance tests - they import prisma via @/ path alias
|
# Required for acceptance tests - they import prisma via @/ path alias
|
||||||
# and @cucumber/cucumber for cucumber-e2e tests
|
# and @cucumber/cucumber for cucumber-e2e tests
|
||||||
|
- name: Compute dependency cache key
|
||||||
|
id: npm-key
|
||||||
|
run: |
|
||||||
|
echo "hash=$(sha256sum package-lock.json | cut -d' ' -f1)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache node_modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
node_modules
|
||||||
|
~/.npm
|
||||||
|
key: npm-${{ runner.os }}-${{ steps.npm-key.outputs.hash }}
|
||||||
|
restore-keys: |
|
||||||
|
npm-${{ runner.os }}-
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci --legacy-peer-deps
|
run: npm ci --legacy-peer-deps
|
||||||
|
|
||||||
@@ -60,11 +90,19 @@ jobs:
|
|||||||
echo "pr_number=$(echo $GITHUB_REF | grep -oP 'refs/pull/\K[0-9]+')" >> $GITHUB_OUTPUT
|
echo "pr_number=$(echo $GITHUB_REF | grep -oP 'refs/pull/\K[0-9]+')" >> $GITHUB_OUTPUT
|
||||||
echo "short_sha=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_OUTPUT
|
echo "short_sha=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Login to Registry
|
||||||
|
run: |
|
||||||
|
docker login ${{ env.REGISTRY }} -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Build Docker image for PR
|
- name: Build Docker image for PR
|
||||||
|
env:
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
run: |
|
run: |
|
||||||
IMAGE_TAG="pr-${{ steps.info.outputs.pr_number }}-${{ steps.info.outputs.short_sha }}"
|
IMAGE_TAG="pr-${{ steps.info.outputs.pr_number }}-${{ steps.info.outputs.short_sha }}"
|
||||||
docker build \
|
docker build \
|
||||||
--target runner \
|
--target runner \
|
||||||
|
--cache-from type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache \
|
||||||
|
--cache-to type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max \
|
||||||
--build-arg GIT_COMMIT=$GITHUB_SHA \
|
--build-arg GIT_COMMIT=$GITHUB_SHA \
|
||||||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${IMAGE_TAG} \
|
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${IMAGE_TAG} \
|
||||||
.
|
.
|
||||||
|
|||||||
@@ -109,9 +109,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Build test-capable image
|
- name: Build test-capable image
|
||||||
if: steps.commit.outputs.committed == 'true'
|
if: steps.commit.outputs.committed == 'true'
|
||||||
|
env:
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
--target test-runner \
|
--target test-runner \
|
||||||
|
--cache-from type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-test \
|
||||||
|
--cache-to type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-test,mode=max \
|
||||||
--build-arg GIT_COMMIT=${{ github.sha }} \
|
--build-arg GIT_COMMIT=${{ github.sha }} \
|
||||||
-t ${{ env.IMAGE_NAME }}-test:${{ steps.version.outputs.new_version }} \
|
-t ${{ env.IMAGE_NAME }}-test:${{ steps.version.outputs.new_version }} \
|
||||||
.
|
.
|
||||||
@@ -127,9 +131,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Build production image
|
- name: Build production image
|
||||||
if: steps.commit.outputs.committed == 'true'
|
if: steps.commit.outputs.committed == 'true'
|
||||||
|
env:
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
--target runner \
|
--target runner \
|
||||||
|
--cache-from type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache \
|
||||||
|
--cache-to type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max \
|
||||||
--build-arg GIT_COMMIT=${{ github.sha }} \
|
--build-arg GIT_COMMIT=${{ github.sha }} \
|
||||||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.new_version }} \
|
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.new_version }} \
|
||||||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
|
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
|
||||||
|
|||||||
Reference in New Issue
Block a user