Skip to content

Commit

Permalink
Merge pull request #59 from amaysim-au/task/APP-5322-update-yarn-to-v2
Browse files Browse the repository at this point in the history
APP-5322-update-yarn-to-v2
  • Loading branch information
farhad-ris authored Sep 25, 2024
2 parents 77551ee + ddce3ff commit a6ca75a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
45 changes: 30 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Arguments
ARG NODE_ALPINE_IMAGE
FROM $NODE_ALPINE_IMAGE

Expand All @@ -6,26 +7,40 @@ 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
# Enable Corepack and set Yarn to Berry version and install Serverless
RUN npm install -g corepack && \
corepack enable && \
yarn set version berry && \
yarn --version && \
npm install -g serverless@$SERVERLESS_VERSION && \
serverless --version

RUN ln -sf /opt/yarn/dist/bin/yarn /usr/local/bin/yarn && \
ln -sf /opt/yarn/dist/bin/yarn /usr/local/bin/yarnpkg && \
yarn --version

RUN yarn global add serverless@$SERVERLESS_VERSION

WORKDIR /opt/app
WORKDIR /opt/app
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -56,6 +57,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

Expand Down

0 comments on commit a6ca75a

Please sign in to comment.