From 3bf8e2c3584cbd465b683c87cf730e05bec0e880 Mon Sep 17 00:00:00 2001
From: Hugo Trentesaux <hugo@trentesaux.fr>
Date: Tue, 16 Apr 2024 12:26:46 +0200
Subject: [PATCH] wip dockerfile

---
 Dockerfile           | 24 ++++++++++++++++++++++++
 src/scripts/hello.ts |  1 +
 2 files changed, 25 insertions(+)
 create mode 100644 Dockerfile
 create mode 100644 src/scripts/hello.ts

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..4425bea
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,24 @@
+# global node image
+FROM node:20-alpine AS base
+ENV PNPM_HOME="/pnpm"
+ENV PATH="$PNPM_HOME:$PATH"
+RUN corepack enable
+COPY . /app
+WORKDIR /app
+
+# build deps
+FROM base as deps
+RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
+
+# datapod image
+FROM base
+COPY --from=deps /app/node_modules /app/node_modules
+CMD ["npx", "tsx", "src/scripts/hello.ts"]
+
+
+# TODO build image only for indexer without app
+# TODO really build for node and not use tsx (is it necessary)
+
+# build and run for test
+# docker buildx build . -t test-datapod
+# docker run --rm -it test-datapod
diff --git a/src/scripts/hello.ts b/src/scripts/hello.ts
new file mode 100644
index 0000000..7e2c877
--- /dev/null
+++ b/src/scripts/hello.ts
@@ -0,0 +1 @@
+console.log('Hello World!')
-- 
GitLab