Skip to content

Commit 49917c4

Browse files
authored
Feat arm64 (#16)
* arm64 support. * sync json. * linux only. * sync json. * fix platform select. * sync json. * fix test * platform * fix return code. * fix lib path. * update docs.
1 parent c576e3a commit 49917c4

File tree

9 files changed

+47
-31
lines changed

9 files changed

+47
-31
lines changed

.github/workflows/_push.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@
1212
},
1313
"jobs": {
1414
"push": {
15-
"name": "push: ${{matrix.distro}}",
15+
"name": "push: ${{matrix.distro}}/${{matrix.arch}}",
1616
"runs-on": "ubuntu-latest",
1717
"strategy": {
1818
"fail-fast": true,
1919
"matrix": {
2020
"distro": [
2121
"alpine",
2222
"distroless"
23+
],
24+
"arch": [
25+
"amd64",
26+
"arm64"
2327
]
2428
}
2529
},
@@ -50,7 +54,7 @@
5054
"pull": true,
5155
"no-cache": true,
5256
"tags": "${{env.tag_f}},${{env.tag_d}}${{matrix.distro == 'distroless' && format(',{0},{1}', env.tag_v, env.tag_l) || ''}}",
53-
"platforms": "linux/amd64",
57+
"platforms": "linux/${{matrix.arch}}",
5458
"context": "{{defaultContext}}:./src",
5559
"file": "${{matrix.distro}}.dockerfile",
5660
"build-args": "DENO_VERSION=${{inputs.deno_version}}"

.github/workflows/_push.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ on:
77
required: true
88
jobs:
99
push:
10-
name: 'push: ${{matrix.distro}}'
10+
name: 'push: ${{matrix.distro}}/${{matrix.arch}}'
1111
runs-on: ubuntu-latest
1212
strategy:
1313
fail-fast: true
1414
matrix:
1515
distro:
1616
- alpine
1717
- distroless
18+
arch:
19+
- amd64
20+
- arm64
1821
env:
1922
tag_f: dojyorin/deno:${{matrix.distro}}-${{inputs.deno_version}}
2023
tag_d: dojyorin/deno:${{matrix.distro}}
@@ -37,7 +40,7 @@ jobs:
3740
pull: true
3841
no-cache: true
3942
tags: ${{env.tag_f}},${{env.tag_d}}${{matrix.distro == 'distroless' && format(',{0},{1}', env.tag_v, env.tag_l) || ''}}
40-
platforms: linux/amd64
43+
platforms: linux/${{matrix.arch}}
4144
context: '{{defaultContext}}:./src'
4245
file: ${{matrix.distro}}.dockerfile
4346
build-args: DENO_VERSION=${{inputs.deno_version}}

.github/workflows/_test.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@
1212
},
1313
"jobs": {
1414
"test": {
15-
"name": "test: ${{matrix.distro}}",
15+
"name": "test: ${{matrix.distro}}/${{matrix.arch}}",
1616
"runs-on": "ubuntu-latest",
1717
"strategy": {
1818
"fail-fast": true,
1919
"matrix": {
2020
"distro": [
2121
"alpine",
2222
"distroless"
23+
],
24+
"arch": [
25+
"amd64",
26+
"arm64"
2327
]
2428
}
2529
},
@@ -36,14 +40,14 @@
3640
"pull": true,
3741
"no-cache": true,
3842
"tags": "${{github.sha}}",
39-
"platforms": "linux/amd64",
43+
"platforms": "linux/${{matrix.arch}}",
4044
"context": "{{defaultContext}}:./src",
4145
"file": "${{matrix.distro}}.dockerfile",
4246
"build-args": "DENO_VERSION=${{inputs.deno_version}}"
4347
}
4448
}, {
4549
"name": "test image",
46-
"run": "docker run --rm --init ${{github.sha}} eval -p 'new Date()'"
50+
"run": "docker run --rm --init --platform linux/${{matrix.arch}} ${{github.sha}} eval -p 'new Date()'"
4751
}]
4852
}
4953
}

.github/workflows/_test.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ on:
77
required: true
88
jobs:
99
test:
10-
name: 'test: ${{matrix.distro}}'
10+
name: 'test: ${{matrix.distro}}/${{matrix.arch}}'
1111
runs-on: ubuntu-latest
1212
strategy:
1313
fail-fast: true
1414
matrix:
1515
distro:
1616
- alpine
1717
- distroless
18+
arch:
19+
- amd64
20+
- arm64
1821
steps:
1922
- name: clone repository
2023
uses: actions/checkout@v4
@@ -26,9 +29,9 @@ jobs:
2629
pull: true
2730
no-cache: true
2831
tags: ${{github.sha}}
29-
platforms: linux/amd64
32+
platforms: linux/${{matrix.arch}}
3033
context: '{{defaultContext}}:./src'
3134
file: ${{matrix.distro}}.dockerfile
3235
build-args: DENO_VERSION=${{inputs.deno_version}}
3336
- name: test image
34-
run: docker run --rm --init ${{github.sha}} eval -p 'new Date()'
37+
run: docker run --rm --init --platform linux/${{matrix.arch}} ${{github.sha}} eval -p 'new Date()'

.github/workflows/cron.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "cron",
33
"on": {
44
"schedule": [{
5-
"cron": "0 6 * * *"
5+
"cron": "0 0 * * *"
66
}]
77
},
88
"jobs": {
@@ -17,11 +17,11 @@
1717
],
1818
"steps": [{
1919
"name": "compare dockerhub tag and deno latest version",
20-
"run": "echo deno_latest=$(! curl -Ls https://registry.hub.docker.com/v2/repositories/dojyorin/deno/tags?page_size=100 | yq '.results[].name' | grep -q ${{needs.fetch.outputs.deno_version}}; echo ${?}) >> ${GITHUB_OUTPUT}"
20+
"run": "echo deno_latest=$(curl -Ls https://registry.hub.docker.com/v2/repositories/dojyorin/deno/tags?page_size=100 | yq '.results[].name' | grep -q ${{needs.fetch.outputs.deno_version}}; echo ${?}) >> ${{github.output}}"
2121
}]
2222
},
2323
"test": {
24-
"if": "${{needs.compare.outputs.deno_latest == '1'}}",
24+
"if": "${{needs.compare.outputs.deno_latest == 1}}",
2525
"uses": "./.github/workflows/_test.yaml",
2626
"with": {
2727
"deno_version": "${{needs.fetch.outputs.deno_version}}"

.github/workflows/cron.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: cron
22
on:
33
schedule:
4-
- cron: 0 6 * * *
4+
- cron: 0 0 * * *
55
jobs:
66
fetch:
77
uses: ./.github/workflows/_fetch.yaml
@@ -12,9 +12,9 @@ jobs:
1212
- fetch
1313
steps:
1414
- name: compare dockerhub tag and deno latest version
15-
run: echo deno_latest=$(! curl -Ls https://registry.hub.docker.com/v2/repositories/dojyorin/deno/tags?page_size=100 | yq '.results[].name' | grep -q ${{needs.fetch.outputs.deno_version}}; echo ${?}) >> ${GITHUB_OUTPUT}
15+
run: echo deno_latest=$(curl -Ls https://registry.hub.docker.com/v2/repositories/dojyorin/deno/tags?page_size=100 | yq '.results[].name' | grep -q ${{needs.fetch.outputs.deno_version}}; echo ${?}) >> ${{github.output}}
1616
test:
17-
if: ${{needs.compare.outputs.deno_latest == '1'}}
17+
if: ${{needs.compare.outputs.deno_latest == 1}}
1818
uses: ./.github/workflows/_test.yaml
1919
with:
2020
deno_version: ${{needs.fetch.outputs.deno_version}}

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77

88
The simple and small deno docker image.
99

10-
This image is published on DockerHub and synchronized with latest version of [denoland/deno](https://github.com/denoland/deno) every day at `06:00` UTC.
10+
This image is published on DockerHub and synchronized with latest version of [denoland/deno](https://github.com/denoland/deno) every day at `00:00` UTC.
1111

1212
Now, let's start using it!
1313

1414
- [`docker.io/dojyorin/deno`](https://hub.docker.com/r/dojyorin/deno)
1515

1616
# Tags
1717

18-
|OS|Tags|Arch|
18+
|OS|Tag|Arch|
1919
|:--|:--|:--|
20-
|Distroless (default)|`latest` `vX.Y.Z` `distroless` `distroless-vX.Y.Z`|`amd64`|
21-
|Alpine|`alpine` `alpine-vX.Y.Z`|`amd64`|
20+
|[distroless](https://github.com/googlecontainertools/distroless) (default)|`latest` `vX.Y.Z` `distroless` `distroless-vX.Y.Z`|`amd64` `arm64`|
21+
|[alpine](https://github.com/alpinelinux/docker-alpine)|`alpine` `alpine-vX.Y.Z`|`amd64` `arm64`|
2222

2323
# How to use
2424
Easy to introduce in your project.
2525

26-
**Notes**
26+
**Note**
2727
- When starting container, be sure to add `--init` flag (`docker run`) or `init: true` property (`docker-compose.yml`) to avoid [PID1 problem](https://www.docker.com/blog/keep-nodejs-rockin-in-docker#:~:text=PID%201%20Problem).
2828
- For security reasons, default runtime user is `nonroot` in distroless and `nobody` in other distributions.
2929

@@ -33,7 +33,7 @@ Easy to introduce in your project.
3333
docker run --rm --init -it dojyorin/deno:latest
3434

3535
# Run script.
36-
docker run --rm --init --restart always -p 0.0.0.0:1993:8000 -v ./src:/data:ro dojyorin/deno:latest run /data/main.ts
36+
docker run --rm --init --restart always -p 0.0.0.0:5000:8000 -v $(pwd)/src:/data:ro dojyorin/deno:latest run /data/main.ts
3737
```
3838

3939
**As compose**
@@ -44,7 +44,7 @@ services:
4444
init: true
4545
restart: always
4646
ports:
47-
- 0.0.0.0:1993:8000
47+
- 0.0.0.0:5000:8000
4848
volumes:
4949
- ./src:/data:ro
5050
command:

src/alpine.dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@ FROM gcr.io/distroless/cc-debian12:latest AS cc
99

1010
FROM alpine:latest AS sym
1111

12-
COPY --from=cc /lib/*-linux-gnu/ld-linux-* /usr/local/lib/
12+
COPY --from=cc --chown=root:root --chmod=755 /lib/*-linux-gnu/ld-linux-* /usr/local/lib/
1313

14-
RUN mkdir /lib64
15-
RUN ln -s /usr/local/lib/ld-linux-* /lib64/
14+
RUN mkdir -p /tmp/lib
15+
RUN ln -s /usr/local/lib/ld-linux-* /tmp/lib/
1616

1717
FROM alpine:latest
1818

1919
ENV LD_LIBRARY_PATH="/usr/local/lib"
2020

2121
COPY --from=deno --chown=root:root --chmod=755 /tmp/deno /usr/local/bin/
2222
COPY --from=cc --chown=root:root --chmod=755 /lib/*-linux-gnu/* /usr/local/lib/
23-
COPY --from=sym --chown=root:root --chmod=755 /lib64 /lib64
23+
COPY --from=sym --chown=root:root --chmod=755 /tmp/lib /lib
24+
COPY --from=sym --chown=root:root --chmod=755 /tmp/lib /lib64
2425

2526
RUN sed -i -e 's|nobody:/|nobody:/home|' /etc/passwd && chown nobody:nobody /home
2627

src/distroless.dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@ FROM gcr.io/distroless/cc-debian12:latest AS cc
99

1010
FROM alpine:latest AS sym
1111

12-
COPY --from=cc /lib/*-linux-gnu/ld-linux-* /usr/local/lib/
12+
COPY --from=cc --chown=root:root --chmod=755 /lib/*-linux-gnu/ld-linux-* /usr/local/lib/
1313

14-
RUN mkdir /lib64
15-
RUN ln -s /usr/local/lib/ld-linux-* /lib64/
14+
RUN mkdir -p /tmp/lib
15+
RUN ln -s /usr/local/lib/ld-linux-* /tmp/lib/
1616

1717
FROM gcr.io/distroless/static-debian12:latest
1818

1919
ENV LD_LIBRARY_PATH="/usr/local/lib"
2020

2121
COPY --from=deno --chown=root:root --chmod=755 /tmp/deno /usr/local/bin/
2222
COPY --from=cc --chown=root:root --chmod=755 /lib/*-linux-gnu/* /usr/local/lib/
23-
COPY --from=sym --chown=root:root --chmod=755 /lib64 /lib64
23+
COPY --from=sym --chown=root:root --chmod=755 /tmp/lib /lib
24+
COPY --from=sym --chown=root:root --chmod=755 /tmp/lib /lib64
2425

2526
USER nonroot
2627
ENTRYPOINT ["/usr/local/bin/deno"]

0 commit comments

Comments
 (0)