Skip to content

Commit 6ba0fb8

Browse files
committed
feat: better conditional syntax in src dockerfile
1 parent 8d8a2ad commit 6ba0fb8

File tree

7 files changed

+31
-58
lines changed

7 files changed

+31
-58
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ ssh: ## Login into built image
7878
.PHONY: ssh
7979

8080
hadolint: ## Run hadolint over dist Dockerfiles
81-
hadolint -V ./dist/alpine/Dockerfile
81+
hadolint -V ./dist/$(TEMPLATE)/Dockerfile
8282
.PHONY: hadolint
8383

8484

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ This image is used together with [wayofdev/docker-php-dev](https://github.com/wa
2626
Has pre-installed packages
2727

2828
* [pnpm](https://pnpm.io/) — Fast, disk space efficient package manager
29+
* [turbo](https://github.com/vercel/turbo) — Incremental bundler and build system optimized for JavaScript and TypeScript, written in Rust – including Turbopack and Turborepo.
2930
* alpine packages:
3031
* git
3132
* curl
33+
* libc6-compat — [turbo dependency](https://github.com/vercel/turbo/issues/2198), starting from `^1.5.6`
3234

3335
If you **like/use** this repository, please consider **starring** it. Thanks!
3436

@@ -57,7 +59,8 @@ $ make generate
5759
Building default image:
5860

5961
```bash
60-
$ git clone [email protected]:wayofdev/docker-node.git
62+
$ git clone [email protected]:wayofdev/docker-node.git && cd docker-node
63+
$ make generate #(optional, to re-create /dist from /src)
6164
$ make build
6265
```
6366

@@ -70,6 +73,7 @@ $ make
7073
Building all images:
7174

7275
```bash
76+
$ make build TEMPLATE="lts-alpine"
7377
$ make build TEMPLATE="19-alpine"
7478
$ make build TEMPLATE="18-alpine"
7579
```
@@ -87,6 +91,7 @@ $ make test
8791
To test all images:
8892

8993
```bash
94+
$ make test TEMPLATE="lts-alpine"
9095
$ make test TEMPLATE="19-alpine"
9196
$ make test TEMPLATE="18-alpine"
9297
```

assets/screenshot.png

110 KB
Loading

dist/18-alpine/Dockerfile

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,12 @@ RUN set -eux; \
2222
apk add --no-cache \
2323
curl \
2424
git \
25-
# For vercel/turbo
2625
libc6-compat \
27-
&& /bin/ash -c 'set -ex && \
28-
ARCH=`uname -m` && \
29-
if [ "$ARCH" == "x86_64" ]; then \
30-
echo "x86_64" && \
31-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" -o /bin/pnpm; \
32-
elif [ "ARCH" == "arm64" ]; then \
33-
echo "arm64" && \
34-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
35-
else \
36-
echo "unknown arch" && \
37-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
38-
fi' \
26+
&& ARCH=$(uname -m) && \
27+
if [ "$ARCH" = "x86_64" ]; then \
28+
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" -o /bin/pnpm; \
29+
elif [ "$ARCH" == "aarch64" ]; then \
30+
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
31+
fi \
3932
&& chmod +x /bin/pnpm \
40-
# https://github.com/vercel/turbo/issues/2198
4133
&& yarn global add turbo

dist/19-alpine/Dockerfile

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,12 @@ RUN set -eux; \
2222
apk add --no-cache \
2323
curl \
2424
git \
25-
# For vercel/turbo
2625
libc6-compat \
27-
&& /bin/ash -c 'set -ex && \
28-
ARCH=`uname -m` && \
29-
if [ "$ARCH" == "x86_64" ]; then \
30-
echo "x86_64" && \
31-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" -o /bin/pnpm; \
32-
elif [ "ARCH" == "arm64" ]; then \
33-
echo "arm64" && \
34-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
35-
else \
36-
echo "unknown arch" && \
37-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
38-
fi' \
26+
&& ARCH=$(uname -m) && \
27+
if [ "$ARCH" = "x86_64" ]; then \
28+
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" -o /bin/pnpm; \
29+
elif [ "$ARCH" == "aarch64" ]; then \
30+
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
31+
fi \
3932
&& chmod +x /bin/pnpm \
40-
# https://github.com/vercel/turbo/issues/2198
4133
&& yarn global add turbo

dist/lts-alpine/Dockerfile

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,12 @@ RUN set -eux; \
2222
apk add --no-cache \
2323
curl \
2424
git \
25-
# For vercel/turbo
2625
libc6-compat \
27-
&& /bin/ash -c 'set -ex && \
28-
ARCH=`uname -m` && \
29-
if [ "$ARCH" == "x86_64" ]; then \
30-
echo "x86_64" && \
31-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" -o /bin/pnpm; \
32-
elif [ "ARCH" == "arm64" ]; then \
33-
echo "arm64" && \
34-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
35-
else \
36-
echo "unknown arch" && \
37-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
38-
fi' \
26+
&& ARCH=$(uname -m) && \
27+
if [ "$ARCH" = "x86_64" ]; then \
28+
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" -o /bin/pnpm; \
29+
elif [ "$ARCH" == "aarch64" ]; then \
30+
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
31+
fi \
3932
&& chmod +x /bin/pnpm \
40-
# https://github.com/vercel/turbo/issues/2198
4133
&& yarn global add turbo

src/Dockerfiles/all/Dockerfile.j2

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,12 @@ RUN set -eux; \
2222
apk add --no-cache \
2323
curl \
2424
git \
25-
# For vercel/turbo
2625
libc6-compat \
27-
&& /bin/ash -c 'set -ex && \
28-
ARCH=`uname -m` && \
29-
if [ "$ARCH" == "x86_64" ]; then \
30-
echo "x86_64" && \
31-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" -o /bin/pnpm; \
32-
elif [ "ARCH" == "arm64" ]; then \
33-
echo "arm64" && \
34-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
35-
else \
36-
echo "unknown arch" && \
37-
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
38-
fi' \
26+
&& ARCH=$(uname -m) && \
27+
if [ "$ARCH" = "x86_64" ]; then \
28+
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" -o /bin/pnpm; \
29+
elif [ "$ARCH" == "aarch64" ]; then \
30+
curl -fsSL "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-arm64" -o /bin/pnpm; \
31+
fi \
3932
&& chmod +x /bin/pnpm \
40-
# https://github.com/vercel/turbo/issues/2198
4133
&& yarn global add turbo

0 commit comments

Comments
 (0)