Open onionhammer opened 1 year ago
Thanks for the feedback @onionhammer , this is something the Oryx team is currently working on, so we're looking forward to seeing that change as well. Here's an issue tracking it in the Oryx repo: https://github.com/microsoft/Oryx/issues/1159
Hmm. Last public movement on that is a year ago. Why not support developers using their own build system in addition to an oryx version? I don't need oryx to run npm run build
it's pure bloat for my use case.
We're aware that the Oryx image being large increases the download time, and are working with Oryx to resolve this. You also mention that you don't need oryx to run npm run build
, and for this, you should be able to prevent those & just upload your built static assets by setting the skip_app_build
or skip_app_build
flags in your workflow file depending on your needs
@thomasgauvin does that save the minute and 40 seconds of downloading the 2gb SWA + oryx image? If not that doesnt help
@onionhammer skipping the app build is a param of the SWA + oryx image, so it does not reduce the time that it takes to download those https://github.com/Azure/static-web-apps/issues/1067#issuecomment-1423023871
Right now, we're focusing on working with Oryx to reduce the size of the image that gets downloaded (by doing language downloads dynamically instead), which should reduce download times. After that, we'll assess providing a build-less/Oryx-less deployment option or other options to continue to reduce build & deploy times
I would love to see the metrics on Oryx, for what percentage of users would be served well by just "upload these files" (i.e. "build-less/oryx-less" option.
I suspect it is sizeable.. perhaps 90%+ people just want to upload static files, or can easily build their files without oryx
We're looking into providing a deploy-only image for folks who want to configure their pipelines, the Oryx-based build+deploy image is intended to suit every possible project that gets created with SWA without additional configuration
It is possible to cut down deployment time at least in half by using @azure/static-web-apps-cli instead of AzureStaticWebApp@0 task.
It can be achieved by creating a dummy repository for @azure/static-web-apps-cli e.g. azure-static-web-apps-cli
package.json in dummy repo
{
"private": true,
"dependencies": {
"@azure/static-web-apps-cli": "^1.1.4"
}
}
deployment.yml
# ...
resources:
repositories:
- repository: AzureStaticWebAppsCliRepo
type: git
name: azure-static-web-apps-cli/azure-static-web-apps-cli
ref: master
# ...
jobs:
- job: deploy
steps:
- checkout: AzureStaticWebAppsCliRepo
- task: Cache@2
displayName: Cache Yarn
inputs:
key: '"azure-static-web-apps-cli" | "yarn_v1" | "$(Agent.OS)" | "node_modules" | yarn.lock'
path: node_modules
cacheHitVar: YARN_CACHE_RESTORED
- script: yarn install --frozen-lockfile
displayName: yarn install --frozen-lockfile
condition: ne(variables.YARN_CACHE_RESTORED, 'true')
# ... (Download build artifacts steps)
- script: |
SWA_CLI_DEPLOYMENT_TOKEN=$(SWA_DEPLOYMENT_TOKEN) \
$(System.DefaultWorkingDirectory)/node_modules/.bin/swa deploy \
-w . \
-a .output/public \
-i .output/server \
--api-language=node \
--api-version=18 \
--env=production
displayName: Deploy AzureStaticWebApp
It shouldn't be the case, but that is not surprising.
This is somewhat of an inconvenience, but it reliably takes 40 seconds for github actions to download the ~2 gigabyte static web apps deploy action docker image, let alone run it.
It would be great if a slimmer static file upload option were made available for those who have simpler processes (like
npm run build
, uploaddist
).