Skip to content

Commit

Permalink
Support for pnpm, bun as well as ARM64 images (#13)
Browse files Browse the repository at this point in the history
* Added support for pnpm

* Added support for Bun

* Added multi-arch docker build
  • Loading branch information
sktan authored Sep 29, 2023
1 parent 4083c8c commit e2e49ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
6 changes: 5 additions & 1 deletion src/tools/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func ProxyRequestHandler(p *httputil.ReverseProxy) func(http.ResponseWriter, *ht
}
}

// Handles the response back to the client once intercepted from CodeArtifact
func ProxyResponseHandler() func(*http.Response) error {
return func(r *http.Response) error {
log.Printf("Received %d response from %s", r.StatusCode, r.Request.URL.String())
Expand Down Expand Up @@ -80,7 +81,10 @@ func ProxyResponseHandler() func(*http.Response) error {
}

// Do some quick fixes to the HTTP response for NPM install requests
if strings.HasPrefix(r.Request.UserAgent(), "npm") {
// Also support for pnpm and bun
if strings.HasPrefix(r.Request.UserAgent(), "npm") ||
strings.HasPrefix(r.Request.UserAgent(), "pnpm") ||
strings.HasPrefix(r.Request.UserAgent(), "Bun") {

// Respond to only requests that respond with JSON
// There might eventually be additional headers i don't know about?
Expand Down

0 comments on commit e2e49ff

Please sign in to comment.