Skip to content

Commit

Permalink
chore: fix broken test (#1626)
Browse files Browse the repository at this point in the history
  • Loading branch information
frozenbonito authored Dec 11, 2022
1 parent 5ea4437 commit 87bab9c
Show file tree
Hide file tree
Showing 9 changed files with 5,207 additions and 290 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

set -euo pipefail

# Initialization - load function handler
source $LAMBDA_TASK_ROOT/"$(echo $_HANDLER | cut -d. -f1).sh"

# Processing
while true; do
HEADERS="$(mktemp)"
# Get an event
EVENT_DATA=$(curl -sS -LD "$HEADERS" -X GET "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/next")
REQUEST_ID=$(grep -Fi Lambda-Runtime-Aws-Request-Id "$HEADERS" | tr -d '[:space:]' | cut -d: -f2)

# Execute the handler function from the script
RESPONSE=$($(echo "$_HANDLER" | cut -d. -f2) "$EVENT_DATA")

# Send the response
curl -s -X POST "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/$REQUEST_ID/response" -d "$RESPONSE" -o /dev/null
done
15 changes: 15 additions & 0 deletions tests/scenario/docker/docker-in-docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:16-bullseye-slim

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG UID=1000
ARG GID=1000
RUN groupmod -g ${GID} node && usermod -u ${UID} -g ${GID} node

COPY install_docker.sh .
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& sh install_docker.sh \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*

USER node
ENV HOME=/home/node
15 changes: 10 additions & 5 deletions tests/scenario/docker/docker-in-docker/app/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ version: '3.8'

services:
hello:
command: sh ./entrypoint.sh
build:
context: .
dockerfile: Dockerfile
args:
UID: ${UID:-1000}
GID: ${GID:-1000}
command: npm run start
environment:
HOST_SERVICE_PATH: ${HOST_SERVICE_PATH}
image: node:16-alpine
ports:
- 3000:3000
privileged: true
volumes:
- .:/app
- ../../../:/serverless-offline
- .:/home/node/app
- ../../../../../:/home/node/serverless-offline
- /var/run/docker.sock:/var/run/docker.sock
working_dir: /app
working_dir: /home/node/app
10 changes: 0 additions & 10 deletions tests/scenario/docker/docker-in-docker/app/entrypoint.sh

This file was deleted.

22 changes: 22 additions & 0 deletions tests/scenario/docker/docker-in-docker/app/install_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env sh

set -e

apt-get update
apt-get remove docker
apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --batch --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" |
tee /etc/apt/sources.list.d/docker.list >/dev/null

apt-get update
apt install -y docker-ce-cli docker-compose-plugin

groupadd docker
usermod -aG docker node
Loading

0 comments on commit 87bab9c

Please sign in to comment.