From 0fbc02b84866b518e581951dcb268816d85e5777 Mon Sep 17 00:00:00 2001 From: Farhad Rismanchian Date: Tue, 24 Sep 2024 15:05:59 +1000 Subject: [PATCH 1/3] APP-5322-update-yarn-to-v2 update the Dockerfile with updated Yarn to V2 --- Dockerfile | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 942a787..ca7fa21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,26 +6,42 @@ FROM $NODE_ALPINE_IMAGE ARG SERVERLESS_VERSION=latest ENV SERVERLESS_VERSION $SERVERLESS_VERSION -RUN apk --no-cache add python3 python3-dev py-pip poetry aws-cli ca-certificates groff less bash make cmake jq curl wget g++ zip git openssh && \ +# Install dependencies +RUN apk --no-cache add \ + python3 \ + python3-dev \ + py-pip \ + poetry \ + aws-cli \ + ca-certificates \ + groff \ + less \ + bash \ + make \ + cmake \ + jq \ + curl \ + wget \ + g++ \ + zip \ + git \ + openssh && \ update-ca-certificates +# Install glibc for alpine RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \ wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-2.34-r0.apk && \ apk add --force-overwrite glibc-2.34-r0.apk && \ rm -f glibc-2.34-r0.apk -RUN mkdir -p /tmp/yarn && \ - mkdir -p /opt/yarn/dist && \ - cd /tmp/yarn && \ - wget -q https://yarnpkg.com/latest.tar.gz && \ - tar zvxf latest.tar.gz && \ - find /tmp/yarn -maxdepth 2 -mindepth 2 -exec mv {} /opt/yarn/dist/ \; && \ - rm -rf /tmp/yarn - -RUN ln -sf /opt/yarn/dist/bin/yarn /usr/local/bin/yarn && \ - ln -sf /opt/yarn/dist/bin/yarn /usr/local/bin/yarnpkg && \ +# Enable Corepack and set Yarn to Berry version +RUN npm install -g corepack && \ + corepack enable && \ + yarn set version berry && \ yarn --version -RUN yarn global add serverless@$SERVERLESS_VERSION +# Use yarn dlx to run serverless without globally installing +RUN yarn dlx serverless@$SERVERLESS_VERSION --version -WORKDIR /opt/app +# Set working directory +WORKDIR /opt/app \ No newline at end of file From 7fbc82752fe150435e909d8dcc39f79936d7be30 Mon Sep 17 00:00:00 2001 From: Farhad Rismanchian Date: Tue, 24 Sep 2024 16:26:36 +1000 Subject: [PATCH 2/3] APP-5322-update-yarn-to-v2 fixing the issue where the yarn global changes forces to change the behaviour --- Dockerfile | 11 +++++------ Makefile | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index ca7fa21..883a964 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# Arguments ARG NODE_ALPINE_IMAGE FROM $NODE_ALPINE_IMAGE @@ -34,14 +35,12 @@ RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/s apk add --force-overwrite glibc-2.34-r0.apk && \ rm -f glibc-2.34-r0.apk -# Enable Corepack and set Yarn to Berry version +# Enable Corepack and set Yarn to Berry version and install Serverless RUN npm install -g corepack && \ corepack enable && \ yarn set version berry && \ - yarn --version + yarn --version && \ + npm install -g serverless@$SERVERLESS_VERSION && \ + serverless --version -# Use yarn dlx to run serverless without globally installing -RUN yarn dlx serverless@$SERVERLESS_VERSION --version - -# Set working directory WORKDIR /opt/app \ No newline at end of file diff --git a/Makefile b/Makefile index 2c70810..ccfd203 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,7 @@ push: env-DOCKER_USERNAME env-DOCKER_ACCESS_TOKEN pull: docker pull $(IMAGE) +# Run the image in interactive mode shell: docker run --rm -it -v $(ROOT_DIR):/opt/app $(IMAGE) bash From ddce3ffecd72738318c1f7e1dae70729a3c71c6f Mon Sep 17 00:00:00 2001 From: Farhad Rismanchian Date: Tue, 24 Sep 2024 17:12:25 +1000 Subject: [PATCH 3/3] APP-5322-update-yarn-to-v2 updating the naming convention --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ccfd203..f967ab8 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ NODE_ALPINE_IMAGE ?= node:lts-alpine3.20 SERVERLESS_VERSION = 3.39.0 +INTERNAL_VERSION = 1.0.0 # SERVERLESS_VERSION ?= $(shell docker run --rm $(NODE_ALPINE_IMAGE) npm show serverless version) IMAGE_NAME ?= amaysim/serverless -IMAGE = $(IMAGE_NAME):$(SERVERLESS_VERSION) +IMAGE = $(IMAGE_NAME):$(SERVERLESS_VERSION)-$(INTERNAL_VERSION) ROOT_DIR = $(dir $(abspath $(firstword $(MAKEFILE_LIST)))) ciTest: deps info build buildMultiArch clean