From bfe846c9b2d2fd3e71448d57059a7c89ec1403e6 Mon Sep 17 00:00:00 2001 From: Sahil Ahuja Date: Thu, 13 Feb 2025 20:26:29 +0530 Subject: [PATCH] Adding template for docker --- .../repo-templates/d/actions-build.Dockerfile | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/repo-templates/d/actions-build.Dockerfile diff --git a/.github/repo-templates/d/actions-build.Dockerfile b/.github/repo-templates/d/actions-build.Dockerfile new file mode 100644 index 0000000..1e84397 --- /dev/null +++ b/.github/repo-templates/d/actions-build.Dockerfile @@ -0,0 +1,29 @@ +FROM repo2.hub.gmetri.io/gmetrivr/basin:node-22-dev-v2 + +#Remove old code +# RUN find . -maxdepth 1 ! \( -name node_modules -o -name .pnpm-store \) -exec rm -rf "{}" \; + +#Replace with new code (node_modules and .pnpm_store are in dockerignore) +COPY --chown=1000:1000 . /src + +#PUBLIC_BUILD_VERSION contains the unique build id for this image +ARG PUBLIC_BUILD_VERSION +ENV PUBLIC_BUILD_VERSION=$PUBLIC_BUILD_VERSION + +#BUILD_STEP is bundle or container. bundle for pushing to s3, container for docker image. +ARG BUILD_STEP +ENV BUILD_STEP=$BUILD_STEP + +RUN if [ "$BUILD_STEP" = "bundle" ]; then \ + echo "BUNDLE version $PUBLIC_BUILD_VERSION"; \ + pnpm install && \ + pnpm build; \ + elif [ "$BUILD_STEP" = "container" ]; then \ + echo "CONTAINER version $PUBLIC_BUILD_VERSION"; \ + pnpm install --production && \ + pnpm prune && \ + pnpm store prune; \ + fi; + +EXPOSE 4225 +CMD ["pnpm", "start-server"]