-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
test(docker): test alpine 3.21 + Node.js 20
Showing
17 changed files
with
1,708 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM node:20-alpine3.21 | ||
|
||
WORKDIR /usr/src/app | ||
COPY --from=app . ./ | ||
COPY --from=utils . ./ | ||
|
||
RUN apk update | ||
|
||
# Only OpenSSL 3 is expected to be on this system | ||
RUN if [ ! -e /usr/lib/libssl.so.3 ]; then echo 'OpenSSL 3 not found in /usr/lib/libssl.so.3'; exit 1; fi | ||
RUN if [ -e /usr/lib/libssl.so.1.1 ]; then echo 'OpenSSL 1.1 must not be installed (found in /usr/lib/libssl.so.1.1)'; exit 1; fi | ||
|
||
# Ensure the old platform-specific paths are not containing OpenSSL | ||
RUN if [ -e /lib/libssl.so.3 ]; then echo '/lib/libssl.so.3 must not exist'; exit 1; fi | ||
RUN if [ -e /lib/libssl.so.1.1 ]; then echo '/lib/libssl.so.1.1'; exit 1; fi | ||
|
||
# expected target platform for Prisma, retrieved by `prisma -v` | ||
ARG EXPECTED_PRISMA_TARGET_PLATFORM="linux-musl-openssl-3.0.x" | ||
ARG PRISMA_ENGINES_MIRROR | ||
ARG PRISMA_CLIENT_ENGINE_TYPE | ||
ARG PRISMA_CLI_QUERY_ENGINE_TYPE | ||
ARG CI | ||
ARG DEBUG | ||
ARG PRISMA_TELEMETRY_INFORMATION | ||
|
||
ENV PRISMA_ENGINES_MIRROR=$PRISMA_ENGINES_MIRROR | ||
ENV PRISMA_CLIENT_ENGINE_TYPE=$PRISMA_CLIENT_ENGINE_TYPE | ||
ENV PRISMA_CLI_QUERY_ENGINE_TYPE=$PRISMA_CLI_QUERY_ENGINE_TYPE | ||
ENV CI=$CI | ||
ENV DEBUG=$DEBUG | ||
ENV PRISMA_TELEMETRY_INFORMATION=$PRISMA_TELEMETRY_INFORMATION | ||
ENV EXPECTED_PRISMA_TARGET_PLATFORM=$EXPECTED_PRISMA_TARGET_PLATFORM | ||
|
||
RUN npm i -g pnpm@8 | ||
RUN pnpm install | ||
RUN ./version.sh | ||
RUN pnpm prisma generate | ||
|
||
CMD node server.js | ||
EXPOSE 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# OS support: alpine-3.21-node-20-amd64-openssl-3.0.x | ||
|
||
- Base Docker image: `node:20-alpine3.21` | ||
- OS: Linux Alpine 3.21 | ||
- Arch: amd64 (x86_64) | ||
- OpenSSL location: `/usr/lib/libssl.so.3` | ||
- Binary target: `linux-musl-openssl-3.0.x` |
17 changes: 17 additions & 0 deletions
17
docker/alpine-3.21-node-20-amd64-openssl-3.0.x/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "@prisma/alpine-3.21-node-20-amd64-openssl-3.0.x", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "18.19.67", | ||
"prisma": "6.1.0-dev.34", | ||
"ts-node": "10.9.2", | ||
"typescript": "5.6.3" | ||
}, | ||
"scripts": { | ||
"start": "node server.js" | ||
}, | ||
"dependencies": { | ||
"@prisma/client": "6.1.0-dev.34", | ||
"express": "4.21.1" | ||
} | ||
} |
673 changes: 673 additions & 0 deletions
673
docker/alpine-3.21-node-20-amd64-openssl-3.0.x/pnpm-lock.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
docker/alpine-3.21-node-20-amd64-openssl-3.0.x/prisma/schema.prisma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
model User { | ||
id String @id @default(cuid()) | ||
email String @unique | ||
name String? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
|
||
set -eux | ||
export DEBUG="*" | ||
|
||
DOCKER_PLATFORM_ARCH="linux/amd64" | ||
PRISMA_DOCKER_IMAGE_NAME="prisma-alpine-3.21-node-20-amd64-openssl-3.0.x" | ||
|
||
docker buildx build --load \ | ||
--platform="${DOCKER_PLATFORM_ARCH}" \ | ||
--build-context app=. \ | ||
--build-context utils=../../docker/_utils \ | ||
--build-arg DEBUG=${DEBUG} \ | ||
--build-arg PRISMA_TELEMETRY_INFORMATION="${PRISMA_TELEMETRY_INFORMATION}" \ | ||
--build-arg PRISMA_ENGINES_MIRROR=${PRISMA_ENGINES_MIRROR} \ | ||
--build-arg PRISMA_CLIENT_ENGINE_TYPE=${PRISMA_CLIENT_ENGINE_TYPE} \ | ||
--build-arg PRISMA_CLI_QUERY_ENGINE_TYPE=${PRISMA_CLIENT_ENGINE_TYPE} \ | ||
--build-arg CI=${CI} \ | ||
. -t "${PRISMA_DOCKER_IMAGE_NAME}" \ | ||
--progress plain | ||
|
||
docker run -p 3000:3000 \ | ||
-e DEBUG=${DEBUG} \ | ||
-e DATABASE_URL=${DATABASE_URL} \ | ||
-e CI=${CI} \ | ||
-e PRISMA_CLIENT_ENGINE_TYPE=${PRISMA_CLIENT_ENGINE_TYPE} \ | ||
-e PRISMA_CLI_QUERY_ENGINE_TYPE=${PRISMA_CLIENT_ENGINE_TYPE} \ | ||
-e PRISMA_TELEMETRY_INFORMATION="${PRISMA_TELEMETRY_INFORMATION}" \ | ||
"${PRISMA_DOCKER_IMAGE_NAME}" & | ||
|
||
sleep 15 | ||
|
||
pnpm install | ||
pnpm prisma generate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env node | ||
|
||
const express = require('express') | ||
const app = express() | ||
const port = 3000 | ||
|
||
const { PrismaClient } = require('@prisma/client') | ||
|
||
const client = new PrismaClient() | ||
|
||
app.get('/', async (req, res) => { | ||
const data = await client.user.findMany() | ||
res.send(JSON.stringify(data)) | ||
}) | ||
|
||
app.listen(port, () => { | ||
console.log(`App listening at http://localhost:${port}`) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
expected="[]" | ||
actual=$(curl localhost:3000) | ||
|
||
if [ "$expected" != "$actual" ]; then | ||
echo "expected '$expected', got '$actual'" | ||
docker stop $(docker ps -a -q) | ||
exit 1 | ||
fi | ||
|
||
echo "result: $actual" | ||
docker stop $(docker ps -a -q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
FROM node:20-alpine3.21 | ||
|
||
WORKDIR /usr/src/app | ||
COPY --from=app . ./ | ||
COPY --from=utils . ./ | ||
|
||
RUN apk update | ||
|
||
# Only OpenSSL 3 is expected to be on this system | ||
RUN if [ ! -e /usr/lib/libssl.so.3 ]; then echo 'OpenSSL 3 not found in /usr/lib/libssl.so.3'; exit 1; fi | ||
RUN if [ -e /usr/lib/libssl.so.1.1 ]; then echo 'OpenSSL 1.1 must not be installed (found in /usr/lib/libssl.so.1.1)'; exit 1; fi | ||
|
||
# Ensure the old platform-specific paths are not containing OpenSSL | ||
RUN if [ -e /lib/libssl.so.3 ]; then echo '/lib/libssl.so.3 must not exist'; exit 1; fi | ||
RUN if [ -e /lib/libssl.so.1.1 ]; then echo '/lib/libssl.so.1.1'; exit 1; fi | ||
|
||
# expected target platform for Prisma, retrieved by `prisma -v` | ||
ARG EXPECTED_PRISMA_TARGET_PLATFORM="linux-musl-arm64-openssl-3.0.x" | ||
ARG PRISMA_ENGINES_MIRROR | ||
ARG PRISMA_CLIENT_ENGINE_TYPE | ||
ARG PRISMA_CLI_QUERY_ENGINE_TYPE | ||
ARG CI | ||
ARG DEBUG | ||
ARG PRISMA_TELEMETRY_INFORMATION | ||
|
||
ENV PRISMA_ENGINES_MIRROR=$PRISMA_ENGINES_MIRROR | ||
ENV PRISMA_CLIENT_ENGINE_TYPE=$PRISMA_CLIENT_ENGINE_TYPE | ||
ENV PRISMA_CLI_QUERY_ENGINE_TYPE=$PRISMA_CLI_QUERY_ENGINE_TYPE | ||
ENV CI=$CI | ||
ENV DEBUG=$DEBUG | ||
ENV PRISMA_TELEMETRY_INFORMATION=$PRISMA_TELEMETRY_INFORMATION | ||
ENV EXPECTED_PRISMA_TARGET_PLATFORM=$EXPECTED_PRISMA_TARGET_PLATFORM | ||
|
||
RUN npm i -g pnpm@8 | ||
RUN pnpm install | ||
RUN ./version.sh | ||
RUN pnpm prisma generate | ||
|
||
CMD node server.js | ||
EXPOSE 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# OS support: alpine-3.21-node-20-arm64-openssl-3.0.x | ||
|
||
- Base Docker image: `node:20-alpine3.21` | ||
- OS: Linux Alpine 3.21 | ||
- Arch: arm64 (aarch64) | ||
- OpenSSL location: `/usr/lib/libssl.so.3` | ||
- Binary target: `linux-musl-arm64-openssl-3.0.x` |
17 changes: 17 additions & 0 deletions
17
docker/alpine-3.21-node-20-arm64-openssl-3.0.x/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "@prisma/alpine-3.21-node-20-arm64-openssl-3.0.x", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "18.19.67", | ||
"prisma": "6.1.0-dev.34", | ||
"ts-node": "10.9.2", | ||
"typescript": "5.6.3" | ||
}, | ||
"scripts": { | ||
"start": "node server.js" | ||
}, | ||
"dependencies": { | ||
"@prisma/client": "6.1.0-dev.34", | ||
"express": "4.21.1" | ||
} | ||
} |
739 changes: 739 additions & 0 deletions
739
docker/alpine-3.21-node-20-arm64-openssl-3.0.x/pnpm-lock.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
docker/alpine-3.21-node-20-arm64-openssl-3.0.x/prisma/schema.prisma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
model User { | ||
id String @id @default(cuid()) | ||
email String @unique | ||
name String? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
|
||
set -eux | ||
export DEBUG="*" | ||
|
||
DOCKER_PLATFORM_ARCH="linux/arm64" | ||
PRISMA_DOCKER_IMAGE_NAME="prisma-alpine-3.21-node-20-arm64-openssl-3.0.x" | ||
|
||
docker buildx build --load \ | ||
--platform="${DOCKER_PLATFORM_ARCH}" \ | ||
--build-context app=. \ | ||
--build-context utils=../../docker/_utils \ | ||
--build-arg DEBUG=${DEBUG} \ | ||
--build-arg PRISMA_TELEMETRY_INFORMATION="${PRISMA_TELEMETRY_INFORMATION}" \ | ||
--build-arg PRISMA_ENGINES_MIRROR=${PRISMA_ENGINES_MIRROR} \ | ||
--build-arg PRISMA_CLIENT_ENGINE_TYPE=${PRISMA_CLIENT_ENGINE_TYPE} \ | ||
--build-arg PRISMA_CLI_QUERY_ENGINE_TYPE=${PRISMA_CLIENT_ENGINE_TYPE} \ | ||
--build-arg CI=${CI} \ | ||
. -t "${PRISMA_DOCKER_IMAGE_NAME}" \ | ||
--progress plain | ||
|
||
docker run -p 3000:3000 \ | ||
-e DEBUG=${DEBUG} \ | ||
-e DATABASE_URL=${DATABASE_URL} \ | ||
-e CI=${CI} \ | ||
-e PRISMA_CLIENT_ENGINE_TYPE=${PRISMA_CLIENT_ENGINE_TYPE} \ | ||
-e PRISMA_CLI_QUERY_ENGINE_TYPE=${PRISMA_CLIENT_ENGINE_TYPE} \ | ||
-e PRISMA_TELEMETRY_INFORMATION="${PRISMA_TELEMETRY_INFORMATION}" \ | ||
"${PRISMA_DOCKER_IMAGE_NAME}" & | ||
|
||
sleep 15 | ||
|
||
pnpm install | ||
pnpm prisma generate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env node | ||
|
||
const express = require('express') | ||
const app = express() | ||
const port = 3000 | ||
|
||
const { PrismaClient } = require('@prisma/client') | ||
|
||
const client = new PrismaClient() | ||
|
||
app.get('/', async (req, res) => { | ||
const data = await client.user.findMany() | ||
res.send(JSON.stringify(data)) | ||
}) | ||
|
||
app.listen(port, () => { | ||
console.log(`App listening at http://localhost:${port}`) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
expected="[]" | ||
actual=$(curl localhost:3000) | ||
|
||
if [ "$expected" != "$actual" ]; then | ||
echo "expected '$expected', got '$actual'" | ||
docker stop $(docker ps -a -q) | ||
exit 1 | ||
fi | ||
|
||
echo "result: $actual" | ||
docker stop $(docker ps -a -q) |