diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69e86f44..5367855a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,3 +122,21 @@ jobs: with: pass_on_octokit_error: false GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + localstack: + runs-on: ubuntu-latest + steps: + - name: Start LocalStack + run: | + pip install localstack awscli-local[ver1] # install LocalStack cli and awslocal + docker pull localstack/localstack # Make sure to pull the latest version of the image + localstack start -d # Start LocalStack in the background + + echo "Waiting for LocalStack startup..." # Wait 30 seconds for the LocalStack container + localstack wait -t 30 # to become ready before timing out + echo "Startup complete" + - name: Run some Tests against LocalStack + run: | + awslocal s3 mb s3://test + awslocal s3 ls + echo "Test Execution complete!" diff --git a/.gitignore b/.gitignore index 92789d41..16d1013a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ dist coverage node_modules temp +volume # Fixtures fixtures/output/* diff --git a/.gitpod.yml b/.gitpod.yml index 07bf47c0..4e44096c 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,20 +1,14 @@ image: - file: .gitpod.Dockerfile - -tasks: - - name: Install Dependencies - init: pnpm i --no-frozen-lockfile + file: docker/gitpod.Dockerfile vscode: extensions: - aaron-bond.better-comments - - codecov.codecov - davidanson.vscode-markdownlint - eamodio.gitlens - editorconfig.editorconfig - esbenp.prettier-vscode - folke.vscode-monorepo-workspace - - google.wireit - foxundermoon.shell-format - mintlify.document - ms-playwright.playwright diff --git a/.nvmrc b/.nvmrc index 08e3ca9b..3e558c9b 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.2.0 +18.12.0 diff --git a/cspell.json b/cspell.json index 33ac5336..dfb6d615 100644 --- a/cspell.json +++ b/cspell.json @@ -23,6 +23,8 @@ "autoload", "autodocs", "aquasecurity", + "awscli", + "awslocal", "backreference", "bierner", "brotli", @@ -74,6 +76,7 @@ "kohler", "lcov", "linebreak", + "localstack", "lukeed", "markdownlint", "markdownlintignore", diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..da743e1a --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,46 @@ +FROM alpine:latest + +LABEL rjoydip.image.authors="Joydip Roy (rjoydip)" + +ENV EXTRA_CORS_ALLOWED_ORIGINS '*' +ENV DISABLE_CORS_CHECKS 1 +ENV DISABLE_CUSTOM_CORS_APIGATEWAY 1 +ENV PYTHONUNBUFFERED=1 + +COPY .nvmrc /tmp/.nvmrc + +RUN apk --no-cache update && \ + apk --no-cache add bash curl && \ + python3.8 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.9/main +# ca-certificates openssl ncurses coreutils make gcc g++ iptables gcompat libstdc++ libgcc libgcc libffi-dev linux-headers grep util-linux binutils findutils + +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash; \ + echo 'source $HOME/.profile;' >> "$HOME"/.zshrc; \ + echo 'export NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release;' >>"$HOME"E/.profile; \ + echo 'nvm_get_arch() { nvm_echo "x64-musl"; }' >> "$HOME"/.profile; \ + NVM_DIR="$HOME/.nvm"; source "$HOME"/.nvm/nvm.sh; source "$HOME"/.profile; \ + nvm install "$(cat /tmp/.nvmrc)" && npm install -g pnpm@latest + +RUN apk --no-cache update && \ + apk --no-cache add bash && \ + apk --no-cache add openjdk8-jre && \ + apk --no-cache add python python-dev libstdc++ openssl-dev linux-headers libffi-dev clang make g++ gcc curl groff less && \ + python3 -m ensurepip && \ + rm -r /usr/lib/python*/ensurepip && \ + pip3 --no-cache-dir install --upgrade pip wheel && \ + pip3 --no-cache-dir install -U setuptools && \ + pip3 --no-cache-dir install psutil awscli urllib3 python-coveralls cfn-lint==0.20.0 && \ + rm -rf /var/cache/apk/* + +RUN pip3 --no-cache-dir install localstack awscli awscli-local + +WORKDIR /workspace/templ + +COPY . . + +RUN pnpm i --no-frozen-lockfile + +HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ + CMD curl -f http://localhost/ || exit 1 + +# USER gitpod diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..b70436e2 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,23 @@ +version: "3.8" + +services: + localstack: + container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}" + image: localstack/localstack + # build: + # context: . + # dockerfile: Dockerfile + ports: + - "127.0.0.1:4566:4566" # LocalStack Gateway + - "127.0.0.1:4510-4559:4510-4559" # External services port range + - "127.0.0.1:53:53" # DNS config + - "127.0.0.1:53:53/udp" # DNS config + - "127.0.0.1:443:443" # LocalStack HTTPS Gateway + environment: + - DEBUG=${DEBUG-} + - PERSISTENCE=${PERSISTENCE-} + - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR-} + - DOCKER_HOST=unix:///var/run/docker.sock + volumes: + - "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack" + - "/var/run/docker.sock:/var/run/docker.sock" diff --git a/.gitpod.Dockerfile b/docker/gitpod.Dockerfile similarity index 69% rename from .gitpod.Dockerfile rename to docker/gitpod.Dockerfile index a7399805..37edd4a2 100644 --- a/.gitpod.Dockerfile +++ b/docker/gitpod.Dockerfile @@ -1,23 +1,16 @@ -FROM gitpod/workspace-full:2022-04-11-18-21-27 +FROM gitpod/workspace-full -# Copy .nvmrc files COPY .nvmrc /tmp/.nvmrc -# Set environment variables -ENV NVM_DIR $HOME/nvm -RUN mkdir -p $NVM_DIR - RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash SHELL ["/bin/bash", "--login", "-c"] -# Install Node.js and PNPM RUN source "$HOME/.nvm/nvm.sh" \ && export NVM_DIR="$HOME/.nvm" \ && [ -s "$NVM_DIR/nvm.sh" ] \ && . "$NVM_DIR/nvm.sh" \ - && VERSION="$(cat /tmp/.nvmrc)" \ - && nvm install "$VERSION" \ - && nvm use "$VERSION" \ + && nvm install "$(cat /tmp/.nvmrc)" \ + && nvm use "$(cat /tmp/.nvmrc)" \ && npm install -g pnpm@latest # Set up the project