Skip to content

Commit 0358f14

Browse files
authored
Upgrade Go to 1.25 (#1192)
1 parent 52c138c commit 0358f14

File tree

19 files changed

+59
-82
lines changed

19 files changed

+59
-82
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Go
1919
uses: actions/setup-go@v5
2020
with:
21-
go-version: 1.23.x
21+
go-version: 1.25.x
2222

2323
- name: Run Deploy Script
2424
run: ./scripts/deploy-ci.sh
@@ -101,7 +101,7 @@ jobs:
101101
- name: Setup Go
102102
uses: actions/setup-go@v5
103103
with:
104-
go-version: 1.23.x
104+
go-version: 1.25.x
105105

106106
- name: Setup Node.js
107107
uses: actions/setup-node@v4

.github/workflows/stage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup Go
1818
uses: actions/setup-go@v5
1919
with:
20-
go-version: 1.23.x
20+
go-version: 1.25.x
2121

2222
- name: Run Deploy Script
2323
run: ./scripts/deploy-ci.sh

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup Go
2323
uses: actions/setup-go@v5
2424
with:
25-
go-version: 1.23.x
25+
go-version: 1.25.x
2626

2727
- name: Setup Deno
2828
uses: denoland/setup-deno@main

Dockerfile

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23-alpine AS builder
1+
FROM golang:1.25-alpine AS builder
22

33
ARG SERVER_VERSION="v136"
44

@@ -8,31 +8,25 @@ RUN git clone --branch $SERVER_VERSION --depth 1 https://github.com/esm-dev/esm.
88
WORKDIR /tmp/esm.sh
99
RUN go build -ldflags="-s -w -X 'github.com/esm-dev/esm.sh/server.VERSION=${SERVER_VERSION}'" -o esmd server/esmd/main.go
1010

11-
# ------
12-
1311
FROM alpine:latest
1412

15-
RUN apk update && \
16-
apk add --no-cache git && \
17-
addgroup -g 1000 esm && \
18-
adduser -u 1000 -G esm -D esm && \
19-
mkdir /esmd && \
20-
chown -R esm:esm /esmd
13+
RUN apk update && apk add --no-cache git
14+
RUN addgroup -g 1000 esm && adduser -u 1000 --home=/esm -G esm -D esm
2115

2216
COPY --from=builder /tmp/esm.sh/esmd /bin/esmd
23-
COPY --from=denoland/deno:bin-2.1.4 --chown=esm:esm /deno /esmd/bin/deno
17+
COPY --from=denoland/deno:bin-2.4.4 --chown=esm:esm /deno /esm/bin/deno
2418

2519
# deno desn't provider musl build yet, the hack below makes the gnu build working in alpine
2620
# see https://github.com/denoland/deno_docker/blob/main/alpine.dockerfile
2721
COPY --from=gcr.io/distroless/cc --chown=root:root --chmod=755 /lib/*-linux-gnu/* /usr/local/lib/
2822
COPY --from=gcr.io/distroless/cc --chown=root:root --chmod=755 /lib/ld-linux-* /lib/
2923
RUN mkdir /lib64 && ln -s /usr/local/lib/ld-linux-* /lib64/
30-
ENV LD_LIBRARY_PATH="/usr/local/lib"
3124

32-
ENV ESMDIR="/esmd"
33-
ENV ESMPORT="8080"
25+
ENV DENO_USE_CGROUPS=1
26+
ENV LD_LIBRARY_PATH="/usr/local/lib"
27+
ENV ESMDIR="/esm"
3428

35-
WORKDIR /esmd
36-
EXPOSE 8080
29+
WORKDIR /esm
30+
EXPOSE 80
3731
USER esm
3832
CMD ["esmd"]

HOSTING.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,15 @@ Recommended hosting requirements:
6060
esm.sh provides a Docker image for fast deployment. You can pull the container image from <https://ghcr.io/esm-dev/esm.sh>.
6161

6262
```bash
63-
docker pull ghcr.io/esm-dev/esm.sh # latest version
64-
docker pull ghcr.io/esm-dev/esm.sh:v136 # specific version
63+
docker pull ghcr.io/esm-dev/esm.sh # latest stable version
64+
docker pull ghcr.io/esm-dev/esm.sh:v136 # specific stable version
65+
docker pull ghcr.io/esm-dev/esm.sh:dev # latest dev version
6566
```
6667

6768
Run the container:
6869

6970
```bash
70-
docker run -p 8080:8080 \
71-
-e NPM_REGISTRY=https://registry.npmjs.org/ \
72-
-e NPM_TOKEN=****** \
73-
-v MY_VOLUME:/esmd \
74-
ghcr.io/esm-dev/esm.sh:latest
71+
docker run -p 80:80 ghcr.io/esm-dev/esm.sh:latest
7572
```
7673

7774
Available environment variables:
@@ -95,7 +92,7 @@ Available environment variables:
9592
- `STORAGE_ACCESS_KEY_ID`: The access key for S3 storage.
9693
- `STORAGE_SECRET_ACCESS_KEY`: The secret key for S3 storage.
9794

98-
You can also create your own Dockerfile based on `ghcr.io/esm-dev/esm.sh`:
95+
You can also create your own Dockerfile with a `config.json` file:
9996

10097
```dockerfile
10198
FROM ghcr.io/esm-dev/esm.sh:latest

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/esm-dev/esm.sh
22

3-
go 1.23.0
3+
go 1.25.0
44

55
require (
66
github.com/Masterminds/semver/v3 v3.4.0
@@ -13,15 +13,15 @@ require (
1313
github.com/yuin/goldmark v1.7.13
1414
github.com/yuin/goldmark-meta v1.1.0
1515
go.etcd.io/bbolt v1.4.2
16-
golang.org/x/net v0.42.0
17-
golang.org/x/term v0.33.0
16+
golang.org/x/net v0.43.0
17+
golang.org/x/term v0.34.0
1818
)
1919

2020
require (
2121
github.com/andybalholm/brotli v1.2.0 // indirect
2222
github.com/rs/cors v1.11.1 // indirect
23-
golang.org/x/crypto v0.40.0 // indirect
24-
golang.org/x/sys v0.34.0 // indirect
25-
golang.org/x/text v0.27.0 // indirect
23+
golang.org/x/crypto v0.41.0 // indirect
24+
golang.org/x/sys v0.35.0 // indirect
25+
golang.org/x/text v0.28.0 // indirect
2626
gopkg.in/yaml.v2 v2.4.0 // indirect
2727
)

go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUei
3030
github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0=
3131
go.etcd.io/bbolt v1.4.2 h1:IrUHp260R8c+zYx/Tm8QZr04CX+qWS5PGfPdevhdm1I=
3232
go.etcd.io/bbolt v1.4.2/go.mod h1:Is8rSHO/b4f3XigBC0lL0+4FwAQv3HXEEIgFMuKHceM=
33-
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
34-
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
35-
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
36-
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
33+
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
34+
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
35+
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
36+
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
3737
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
3838
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
3939
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
40-
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
41-
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
42-
golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg=
43-
golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0=
44-
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
45-
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
40+
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
41+
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
42+
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
43+
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
44+
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
45+
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
4646
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
4747
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
4848
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=

internal/jsrt/deno.go renamed to internal/deno/deno.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package jsrt
1+
package deno
22

33
import (
44
"archive/zip"
@@ -16,6 +16,8 @@ import (
1616
"github.com/ije/gox/utils"
1717
)
1818

19+
const DenoVersion = "2.4.4"
20+
1921
func GetDenoPath(workDir string) (denoPath string, err error) {
2022
if workDir == "" {
2123
return "", errors.New("workDir is empty")
@@ -31,7 +33,7 @@ func GetDenoPath(workDir string) (denoPath string, err error) {
3133
return denoPath, nil
3234
}
3335

34-
err = installDeno(denoPath, "2.2.2")
36+
err = installDeno(denoPath, DenoVersion)
3537
if err != nil {
3638
return "", err
3739
}
@@ -69,7 +71,7 @@ func installDeno(installPath string, version string) (err error) {
6971
}
7072
}
7173

72-
url, err := getDenoInstallURL(version)
74+
url, err := getDenoDotZipURL(version)
7375
if err != nil {
7476
return
7577
}
@@ -129,7 +131,7 @@ func installDeno(installPath string, version string) (err error) {
129131
return nil
130132
}
131133

132-
func getDenoInstallURL(version string) (string, error) {
134+
func getDenoDotZipURL(version string) (string, error) {
133135
var arch string
134136
var os string
135137

scripts/deploy-ci.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ ssh esm.sh << EOF
4242
apt-get install -y git
4343
fi
4444
45-
ufw version
46-
if [ "\$?" == "0" ]; then
47-
ufw allow http
48-
ufw allow https
49-
fi
50-
5145
configjson=/etc/esmd/config.json
5246
servicerc=/etc/systemd/system/esmd.service
5347
reload=no

scripts/deploy.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,6 @@ ssh -p $sshPort ${user}@${host} << EOF
8383
apt-get install -y git
8484
fi
8585
86-
ufw version
87-
if [ "\$?" == "0" ]; then
88-
ufw allow http
89-
ufw allow https
90-
fi
91-
9286
configjson=/etc/esmd/config.json
9387
servicerc=/etc/systemd/system/esmd.service
9488

0 commit comments

Comments
 (0)