Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
329 stars 56 forks source link

Provide a trimmed down alternative to `staticappsclient` image #1067

Open onionhammer opened 1 year ago

onionhammer commented 1 year ago

The staticappsclient docker image is a monstrosity designed to make the easy task of bundling your static web application easy, and provides, in-the-box, basically every language under the sun (along with several vulnerabilities, according to docker desktop), weighing in at an eye watering 2.2 gigabytes.

image

This means every single execution of this github action adds at least 40 seconds just to pull the image.

Describe the solution you'd like I would like a staticappspush or slimmed down alternative github action which has only the necessary dependencies to push pre-built static & api assets up to your azure static web app, leaving the "building" of the app to the implementer, instead of oryx.

Describe alternatives you've considered Perhaps it is possible to use the API? ( https://learn.microsoft.com/en-us/rest/api/appservice/static-sites/create-zip-deployment-for-static-site?tabs=HTTP ) or SWA CLI, which cannot be used with SWAs pointed at github

The time spent on my own build is approximately 6 seconds, out of 1 minute and 30 second total run, thats 93% of the github action time spent on just downloading tooling, configuring node (that already comes with github actions runners), that I dont need

thomasgauvin commented 1 year ago

We're working to reduce the file size of the staticappsclient image. Here's the thread in which we are tracking this https://github.com/Azure/static-web-apps/issues/878 , it may provide more context as well as some alternatives some folks have considered

onionhammer commented 1 year ago

@thomasgauvin While that's valuable, I don't think it's going to be possible to retain the functionality that Oryx provides (which I'm sure somebody cares about) AND keep the barebones functionality of just uploading a static website to azure static webapps that this issue is asking for.

As I outlined in the opening post; Oryx does a lot more work than what I'm guessing a large portion of users actually want or need, while it's good to have as an option, there ought to be an alternative. For Oryx, by accommodating every language and framework under the sun, they necessarily import 99% stuff that no project will ever need.. for example, if I'm building a node app, I dont need a go compiler, or python, etc.

Reshmi-Sriram commented 1 year ago

Hi @onionhammer, Would a way to bypass the Oryx dependency to build your Static Web Apps help the scenario? Because if that's the case we do have a support for skipping app and api builds using skip_app_build and skip_api_build as explained in the documentation here Please do correct me if I misunderstood!

thomasgauvin commented 1 year ago

@Reshmi-Sriram skipping app & api build would likely shave some time off of the build & deploy time for @onionhammer, but there is still the downloading of the Oryx image which is the main thing that @onionhammer is highlighting

@onionhammer I'm going to be bringing up building a slim 'deploy only' image with our eng, similar to how @ajraczkowski did in the issue I mentioned https://github.com/Azure/static-web-apps/issues/878#issuecomment-1246800871

nathanblair commented 8 months ago

I'm about to try the route of using the REST API - its not clear if the REST API allows the appzipurl to be a local file that is uploaded, similar to how the App Service Zip Deploy REST API works (which is also a terrible automation experience...).

I suspect it doesn't allow the appzipurl to be a local file that can be binary-uploaded data and that will be another path of failure of just trying to upload static web assets to an Azure Static Web App. I would defer to whatever method the StaticAppClient is doing to get those files up to the web app but I can't know because its not source-available.