-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: add build caching #14
Open
jacobfogolyan
wants to merge
8
commits into
main
Choose a base branch
from
feat/build-caching
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
15d0b29
chore: add frontend caching
jacobfogolyan 77c72ce
feat: add middleware caching
jacobfogolyan 99408c8
chore: update deploy script
jacobfogolyan ebc2d54
chore: change tag name to version and fix curl req
jacobfogolyan e80c2cd
chore: re-add nuxt env vars
jacobfogolyan 3799929
chore: build caching for middleware action
jacobfogolyan 81b509e
chore: modify deploy script to be more legible
jacobfogolyan fd3987d
chore: set npm registry as inputs
jacobfogolyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,10 @@ inputs: | |
docker_registry_url: | ||
description: 'Docker registry url' | ||
required: false | ||
default: 'registry.vuestorefront.cloud' | ||
default: "registry.storefrontcloud.io" | ||
docker_registry_ref: | ||
description: "Docker registry reference" | ||
required: true | ||
cloud_username: | ||
description: 'Cloud username' | ||
required: true | ||
|
@@ -29,38 +32,38 @@ inputs: | |
default: 'https://registrynpm.storefrontcloud.io' | ||
version: | ||
description: 'Version of the app' | ||
required: false | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
- name: Encode Basic Auth | ||
id: base64-auth | ||
shell: bash | ||
run: | | ||
echo "BASIC_AUTH_TOKEN=$(echo -n ${{ inputs.cloud_username }}:${{ inputs.cloud_password }} | base64 -w 0)" >> "$GITHUB_OUTPUT" | ||
- name: Check for existing image | ||
id: check-existing-image | ||
uses: javajawa/check-registry-for-image@v2 | ||
# Need buildx for caching | ||
- name: Set up Docker Buildx | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need to define buildx before caching happens |
||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login Alokai Docker Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ inputs.docker_registry_url }} | ||
auth: "Basic ${{ steps.base64-auth.outputs.BASIC_AUTH_TOKEN }}" | ||
repository: ${{ inputs.project_name }}-storefrontcloud-io/vue-storefront-middleware | ||
tag: ${{ inputs.version || github.sha }} | ||
- name: Build and publish docker image (middleware) | ||
uses: elgohr/Publish-Docker-Github-Action@v5 | ||
if: ${{ steps.check-existing-image.outputs.exists == 'false' }} | ||
username: ${{ inputs.npm_user }} | ||
password: ${{ inputs.npm_pass }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
name: ${{ inputs.project_name }}-storefrontcloud-io/vue-storefront-middleware:${{ inputs.version || github.sha }} | ||
registry: ${{ inputs.docker_registry_url }} | ||
username: ${{ inputs.cloud_username }} | ||
password: ${{ inputs.cloud_password }} | ||
dockerfile: .vuestorefrontcloud/docker/middleware/Dockerfile-middleware | ||
buildoptions: --compress | ||
buildargs: NPM_EMAIL,NPM_PASS,NPM_USER,NPM_REGISTRY | ||
context: . | ||
file: .vuestorefrontcloud/docker/middleware/Dockerfile-middleware | ||
push: true | ||
tags: ${{ inputs.docker_registry_ref }}/vue-storefront-middleware:${{ inputs.version }} | ||
# Inline cache | ||
cache-from: "type=registry,ref=${{ inputs.docker_registry_ref }}/vue-storefront-middleware:${{ inputs.project_name }}-buildcache" | ||
cache-to: "type=registry,ref=${{ inputs.docker_registry_ref }}/vue-storefront-middleware:${{ inputs.project_name }}-buildcache,mode=max" | ||
build-args: | | ||
NPM_EMAIL=${{ inputs.npm_email }} | ||
NPM_PASS=${{ inputs.npm_pass }} | ||
NPM_USER=${{ inputs.npm_user }} | ||
NPM_REGISTRY=${{ inputs.npm_registry }} | ||
env: | ||
NPM_EMAIL: ${{ inputs.npm_email }} | ||
NPM_PASS: ${{ inputs.npm_pass }} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we by default compute the value? It should be like:
${{ inputs.project_name }}-storefrontcloud-io
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it won't build if i use this change unfortunately. i can't seem to reference inputs within the inputs section of this file. it has to be hard coded.
However within the codebase the continuous-delivery.yml file looks like this
docker_registry_ref: ${{ env.DOCKER_REGISTRY_URL }}/${{ env.CUSTOMER_NAME }}-storefrontcloud-io