From 8a1a87ec69cf475b384d44e38ea606a03ee2ca13 Mon Sep 17 00:00:00 2001 From: Beorn Facchini Date: Sun, 22 Jan 2023 01:00:44 +1100 Subject: [PATCH] Update node install and github actions. --- .github/workflows/release.yml | 12 ++--- README.md | 28 +++++------ jet-mascot.png | Bin 16219 -> 0 bytes pack/base.go | 9 +--- pack/common.go | 72 +++++++++++++++++++++++----- pack/node.go | 12 ++--- pack/python.go | 4 +- pack/ruby.go | 21 +++----- testdata/php/composer/composer.json | 2 +- testdata/ruby/sinatra/Gemfile.lock | 12 ++--- 10 files changed, 98 insertions(+), 74 deletions(-) delete mode 100644 jet-mascot.png diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b3e2daf..b5645a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,11 +8,11 @@ jobs: pack: [go, node, php, python, ruby] steps: - name: Checkout - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3 + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3 with: fetch-depth: 0 - name: Install Go - uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923 # pin@v3 + uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3 with: go-version: 1.18 - name: Test @@ -23,21 +23,21 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3 + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3 with: fetch-depth: 0 - name: Install Go - uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923 # pin@v3 + uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3 with: go-version: 1.18 - name: Generate Token id: generate-token - uses: tibdex/github-app-token@586e1a624db6a5a4ac2c53daeeded60c5e3d50fe # pin@v1 + uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c # pin@v1 with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.PRIVATE_KEY }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@68acf3b1adf004ac9c2f0a4259e85c5f66e99bef # pin@v3 + uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757 # pin@v3 with: args: release --rm-dist env: diff --git a/README.md b/README.md index 535d925..076e674 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # Jet -![Jet mascot](jet-mascot.png) - -[![Build Status](https://img.shields.io/github/workflow/status/lade-io/jet/Release.svg)](https://github.com/lade-io/jet/actions/workflows/release.yml) +[![Build Status](https://img.shields.io/github/actions/workflow/status/lade-io/jet/release.yml)](https://github.com/lade-io/jet/actions/workflows/release.yml) [![Go.Dev Reference](https://img.shields.io/badge/go.dev-reference-blue.svg)](https://pkg.go.dev/github.com/lade-io/jet/pack) [![Release](https://img.shields.io/github/v/release/lade-io/jet.svg)](https://github.com/lade-io/jet/releases/latest) @@ -72,6 +70,8 @@ Debug Node.js app: $ jet debug testdata/node/node12/ FROM node:12 +ENV PATH=/home/node/app/node_modules/.bin:$PATH + USER node RUN mkdir -p /home/node/app/ WORKDIR /home/node/app/ @@ -88,10 +88,9 @@ Debug Python and Django app: ```console $ jet debug testdata/python/django/ -FROM python:3.5 +FROM python:3.9 ENV PATH=/home/web/.local/bin:$PATH -ENV PIP_USER=true RUN groupadd --gid 1000 web \ && useradd --uid 1000 --gid web --shell /bin/bash --create-home web @@ -112,17 +111,13 @@ Debug Ruby on Rails app: ```console $ jet debug testdata/ruby/rails5/ -FROM ruby:2.6.5 - -RUN set -ex \ - && echo "deb http://deb.nodesource.com/node_11.x stretch main" > /etc/apt/sources.list.d/nodesource.list \ - && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \ - && echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ - && curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && apt-get update && apt-get install -y \ - nodejs \ - yarn \ - && rm -rf /var/lib/apt/lists/* +FROM ruby:2.7.7 + +RUN wget -qO node.tar.gz "https://nodejs.org/dist/v18.13.0/node-v18.13.0-linux-x64.tar.gz" \ + && tar -xzf node.tar.gz -C /usr/local --strip-components=1 \ + && rm node.tar.gz + +RUN corepack enable RUN groupadd --gid 1000 web \ && useradd --uid 1000 --gid web --shell /bin/bash --create-home web @@ -146,4 +141,3 @@ CMD ["sh", "-c", "puma -p ${PORT-3000}"] * Test cases imported from [Cloud Foundry Buildpacks](https://github.com/cloudfoundry-community/cf-docs-contrib/wiki/Buildpacks) licensed under [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) -* Graphic designed by brgfx on [Freepik](http://www.freepik.com) diff --git a/jet-mascot.png b/jet-mascot.png deleted file mode 100644 index 5b2b730849d0df279803748387ea0a822917cbc9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16219 zcmV-hKcv8kP)AY-8ie!TZF-a$#4Pn~a9O*R7ja& zPmE_xUr9c5wM$G&IyOp4P1Ko4{odI5%zTDhMB}GZ?Z2Y=+0k9X8w=2Y9omN?ye}54N)pe98N+QYLMRegZ9q674aj&eP7@P*O(~m05GfZ4&^$mO z5(l$oD1|l+**`>TKOk~NC1P?w`nr+FIz28dF62W(Tf+TULf#CO!u7~v1=Fev4-M~A!^F}nI7iIF0Y9g&~`<2Rt(*WSusK+!*?C_tQVol{^^}= zjaD3vzyF+CAx&aDAOiuug))al9q_Few$=ao{Qq@86qpbD1Nm4F$e~& zhdBG`%doSn=B84%SQ^@znGYNf$)zHeQVWZeUaTV!(&hj6u&{`IJ%%A6p{KB$dujRZ z-rm#7`P;Mjh=`v^D~E`R<#lxXz7zMHoXUB5v!#%%kb7-$fwD;|b8HqQ9v#ABW6)+4 z&PgI=WMrTz6nI%X4Of16fn&%uHO0upVObJ$i@Qg8to>+f*Zq7H0000ybW%=J02eU* zLq;S1fcKqD))PW z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43T-Q-1VOOjdg@>noyX|VIq23Ua>0_cpIZcN&|pVz9fdmg2XqYj2L?I> z!JHb&Wk6vLdg}W=^RDkW)6ToL=B2Mca4)ic_IaLpUv+hJOX|dM9X0)B`0^S#g!sVjD3+t7)dEY zUr{_+Or5l3$mIT0AbrA(l)4eQuCxJ;OnrQF&ssZyyGPIQ0e&|e*}R-wClIBSx>_6)f1Lkq(le!AWT&We{=e=6E=+Pc6i3b0of$1kjW41%U_e z93PKI^xJys~XZ?XRvWi44slYM9M8AhLBB$2M7 ze8BUU**KPsq!CvlW2mIA5(&vmB{WeJ3hIZ)#LHu#}M^WAw*MEjFB zA7QjthmL5BPtWxXrlsdg4c;f4R*>6w+6SW(Rx}uP}s%=!ECzb5@m%r9X=u6Ge zmLFppBTA0t1#~*VsY;!AjP8L_g*jndA3v#|nxyEx-fS%G4NCDl&(yM_h?b6I*>+m- z5Ki7w>y%JB%D>`zUo;$;d=ClQ!l>Qf)|4p$Nhm!WRJE1Gw5;;DoLCPEoQ`_x0H*{GFd+6g0dDK)IsekQ)MrFx>Lmh-XTI`24Sj;Je)lqm_NMp0X7 zjN;+rrdl|ML)DVA-UgEh5%p;kv4~QmsB0@uK{9oUL}P;H-(_tJG6;Zp7F+#QvF^Tx zUR!;1vw)Z@J7DP9t?dy9>TaGg7B<$k|0cR&7{`0KzX5Kz0LpGT2=o8|002ovPDHLk FV1g5rW&Z#G diff --git a/pack/base.go b/pack/base.go index b97779f..e69ecdd 100644 --- a/pack/base.go +++ b/pack/base.go @@ -35,7 +35,6 @@ type Metadata struct { Path string Process []string Root Root - Sources []*Source Tools []*Tool User string Variant string @@ -53,17 +52,11 @@ type Root struct { Key string } -type Source struct { - Entry string - File string - Key string -} - type Tool struct { Copy map[string][]string Name string Owner string - Archive bool + Archive string Binary bool Download string Files []string diff --git a/pack/common.go b/pack/common.go index 2e892c2..ad79b9a 100644 --- a/pack/common.go +++ b/pack/common.go @@ -36,6 +36,11 @@ type cacheTransport struct { rt http.RoundTripper } +type nodeVersion struct { + Version string `json:"version"` + LTS interface{} `json:"lts"` +} + func (c *cacheTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) { req.Header.Set("Cache-Control", fmt.Sprintf("max-age=%d", c.maxAge)) resp, err = c.rt.RoundTrip(req) @@ -45,6 +50,20 @@ func (c *cacheTransport) RoundTrip(req *http.Request) (resp *http.Response, err return } +func (n *nodeVersion) Download() string { + return fmt.Sprintf("https://nodejs.org/dist/%[1]s/node-%[1]s-linux-x64.tar.gz", n.Version) +} + +func (n *nodeVersion) IsLTS() bool { + switch data := n.LTS.(type) { + case bool: + return data + case string: + return true + } + return false +} + func init() { cache := diskcache.New(filepath.Join(os.TempDir(), "jet-cache")) transport = &cacheTransport{ @@ -65,13 +84,25 @@ func init() { } } -func getDownload(tool *Tool) error { +func getDownload(tool *Tool) (err error) { name := tool.Name owner := tool.Owner if owner == "" { return nil } + defer func() { + if err == nil && tool.Download == "" { + err = fmt.Errorf("%s tool not found", name) + } + }() + + if name == "node" { + tool.Archive = "/usr/local" + tool.Download, err = getNodeDownload() + return err + } + client := github.NewClient(httpClient) ctx := context.Background() release, _, err := client.Repositories.GetLatestRelease(ctx, owner, name) @@ -88,19 +119,36 @@ func getDownload(tool *Tool) error { if binary.MatchString(asset.GetName()) { tool.Download = asset.GetBrowserDownloadURL() if strings.HasSuffix(tool.Download, ".tar.gz") { - tool.Archive = true + tool.Archive = "/usr/local/bin" } else { tool.Binary = true } break } } - if tool.Download == "" { - return fmt.Errorf("%s tool not found", name) - } return nil } +func getNodeDownload() (string, error) { + resp, err := httpClient.Get("https://nodejs.org/dist/index.json") + if err != nil { + return "", err + } + defer resp.Body.Close() + + var versions []nodeVersion + if err = json.NewDecoder(resp.Body).Decode(&versions); err != nil { + return "", err + } + + for _, version := range versions { + if version.IsLTS() { + return version.Download(), nil + } + } + return "", nil +} + func getPath(dir string, meta *Metadata) error { defer func() { current := filepath.Clean(meta.Path) == "." @@ -300,17 +348,15 @@ func fileRead(dir, file string) ([]byte, error) { const dockerString = `FROM {{.Name}}:{{.Version}} {{if .Packages}} RUN set -ex \ -{{range .Sources}} && echo "{{.Entry}}" > /etc/apt/sources.list.d/{{.File}} \ - && curl -fsSL {{.Key}} | apt-key add - \ -{{end}} && apt-get update && apt-get install -y \ + && apt-get update && apt-get install -y \ {{range .Packages}} {{.}} \ {{end}} && rm -rf /var/lib/apt/lists/* {{end}}{{range .Tools}}{{if .Download}}{{if .Archive}} -RUN wget -O {{.Name}}.tar.gz "{{.Download}}" \ - && tar -xzf {{.Name}}.tar.gz -C /usr/local/bin --strip-components=1 \ +RUN wget -qO {{.Name}}.tar.gz "{{.Download}}" \ + && tar -xzf {{.Name}}.tar.gz -C {{.Archive}} --strip-components=1 \ && rm {{.Name}}.tar.gz {{else if .Binary}} -RUN wget -O {{.Name}} "{{.Download}}" \ +RUN wget -qO {{.Name}} "{{.Download}}" \ && chmod +x {{.Name}} && mv {{.Name}} /usr/local/bin {{else}} RUN {{.Download}} @@ -327,12 +373,12 @@ RUN groupadd --gid 1000 {{.User}} \ USER {{.User}} RUN mkdir -p {{.Path}} WORKDIR {{.Path}} -{{range $t := .Tools}}{{range $dir, $files := .Copy}} +{{range $t := .Tools}}{{if or .Copy .Install}}{{range $dir, $files := .Copy}} COPY {{if $.User}}--chown={{$.User}}:{{$.User}} {{end}} {{- range $files}}{{.}} {{end}}{{$dir}}/{{end}}{{if .Install}} RUN {{range $i, $e := .Install}}{{if $i}} \ && {{end}}{{if $t.Name}}{{$t.Name}} {{end}}{{$e}}{{end}}{{end}} -{{end}}{{if .Process}} +{{end}}{{end}}{{if .Process}} CMD [{{range $i, $e := .Process}}{{if $i}}, {{end}}"{{$e}}"{{end}}] {{end -}} ` diff --git a/pack/node.go b/pack/node.go index c132b29..dba2fcb 100644 --- a/pack/node.go +++ b/pack/node.go @@ -16,16 +16,14 @@ func (n *NodePack) Detect() bool { } func (n *NodePack) Metadata() *Metadata { + user := "node" meta := &Metadata{ - User: "node", + Env: map[string]string{ + "PATH": "/home/" + user + "/app/node_modules/.bin:$PATH", + }, + User: user, } if fileExists(n.WorkDir, "yarn.lock") { - meta.Packages = append(meta.Packages, "yarn") - meta.Sources = append(meta.Sources, &Source{ - Entry: "deb http://dl.yarnpkg.com/debian/ stable main", - Key: "https://dl.yarnpkg.com/debian/pubkey.gpg", - File: "yarn.list", - }) meta.Tools = append(meta.Tools, &Tool{ Name: "yarn", Files: []string{"**/package.json", "yarn.lock"}, diff --git a/pack/python.go b/pack/python.go index 74b9589..f83c95a 100644 --- a/pack/python.go +++ b/pack/python.go @@ -42,8 +42,8 @@ func (p *PythonPack) Metadata() *Metadata { case fileExists(p.WorkDir, "setup.py"): meta.Tools = append(meta.Tools, &Tool{ Name: "pip-compile", - Download: "pip install pip-tools==5.5.0", - Files: []string{"setup.py"}, + Download: "pip install pip-tools", + Files: []string{"."}, Install: []string{"setup.py"}, }) case fileExists(p.WorkDir, "environment.yml"): diff --git a/pack/ruby.go b/pack/ruby.go index 46381eb..d27a28a 100644 --- a/pack/ruby.go +++ b/pack/ruby.go @@ -44,25 +44,18 @@ func (r *RubyPack) Metadata() *Metadata { } if node { - meta.Packages = append(meta.Packages, "nodejs") - meta.Sources = append(meta.Sources, &Source{ - Entry: "deb http://deb.nodesource.com/node_11.x stretch main", - Key: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key", - File: "nodesource.list", + meta.Tools = append(meta.Tools, &Tool{ + Name: "node", + Owner: "nodejs", }) } if yarn { - meta.Packages = append(meta.Packages, "yarn") - meta.Sources = append(meta.Sources, &Source{ - Entry: "deb http://dl.yarnpkg.com/debian/ stable main", - Key: "https://dl.yarnpkg.com/debian/pubkey.gpg", - File: "yarn.list", - }) meta.Tools = append(meta.Tools, &Tool{ - Name: "yarn", - Files: []string{"package.json", "yarn.lock"}, - Install: []string{"install"}, + Name: "yarn", + Download: "corepack enable", + Files: []string{"package.json", "yarn.lock"}, + Install: []string{"install"}, }) } return meta diff --git a/testdata/php/composer/composer.json b/testdata/php/composer/composer.json index db4bd52..8d82299 100644 --- a/testdata/php/composer/composer.json +++ b/testdata/php/composer/composer.json @@ -1,6 +1,6 @@ { "require": { - "php": ">=7.2", + "php": "~8.1", "ext-amqp": "*", "ext-apcu": "*", "ext-bz2": "*", diff --git a/testdata/ruby/sinatra/Gemfile.lock b/testdata/ruby/sinatra/Gemfile.lock index deb44d8..791690c 100644 --- a/testdata/ruby/sinatra/Gemfile.lock +++ b/testdata/ruby/sinatra/Gemfile.lock @@ -1,14 +1,14 @@ GEM remote: https://rubygems.org/ specs: - rack (1.5.2) - rack-protection (1.5.2) + rack (1.6.5) + rack-protection (1.5.3) rack - sinatra (1.4.4) - rack (~> 1.4) + sinatra (1.4.8) + rack (~> 1.5) rack-protection (~> 1.4) - tilt (~> 1.3, >= 1.3.4) - tilt (1.4.1) + tilt (>= 1.3, < 3) + tilt (2.0.6) PLATFORMS ruby