Skip to content

Commit 87bab9c

Browse files
authored
chore: fix broken test (#1626)
1 parent 5ea4437 commit 87bab9c

File tree

9 files changed

+5207
-290
lines changed

9 files changed

+5207
-290
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
3+
set -euo pipefail
4+
5+
# Initialization - load function handler
6+
source $LAMBDA_TASK_ROOT/"$(echo $_HANDLER | cut -d. -f1).sh"
7+
8+
# Processing
9+
while true; do
10+
HEADERS="$(mktemp)"
11+
# Get an event
12+
EVENT_DATA=$(curl -sS -LD "$HEADERS" -X GET "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/next")
13+
REQUEST_ID=$(grep -Fi Lambda-Runtime-Aws-Request-Id "$HEADERS" | tr -d '[:space:]' | cut -d: -f2)
14+
15+
# Execute the handler function from the script
16+
RESPONSE=$($(echo "$_HANDLER" | cut -d. -f2) "$EVENT_DATA")
17+
18+
# Send the response
19+
curl -s -X POST "http://${AWS_LAMBDA_RUNTIME_API}/2018-06-01/runtime/invocation/$REQUEST_ID/response" -d "$RESPONSE" -o /dev/null
20+
done
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:16-bullseye-slim
2+
3+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4+
5+
ARG UID=1000
6+
ARG GID=1000
7+
RUN groupmod -g ${GID} node && usermod -u ${UID} -g ${GID} node
8+
9+
COPY install_docker.sh .
10+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
11+
&& sh install_docker.sh \
12+
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
13+
14+
USER node
15+
ENV HOME=/home/node

tests/scenario/docker/docker-in-docker/app/docker-compose.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@ version: '3.8'
22

33
services:
44
hello:
5-
command: sh ./entrypoint.sh
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
args:
9+
UID: ${UID:-1000}
10+
GID: ${GID:-1000}
11+
command: npm run start
612
environment:
713
HOST_SERVICE_PATH: ${HOST_SERVICE_PATH}
8-
image: node:16-alpine
914
ports:
1015
- 3000:3000
1116
privileged: true
1217
volumes:
13-
- .:/app
14-
- ../../../:/serverless-offline
18+
- .:/home/node/app
19+
- ../../../../../:/home/node/serverless-offline
1520
- /var/run/docker.sock:/var/run/docker.sock
16-
working_dir: /app
21+
working_dir: /home/node/app

tests/scenario/docker/docker-in-docker/app/entrypoint.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env sh
2+
3+
set -e
4+
5+
apt-get update
6+
apt-get remove docker
7+
apt-get install -y \
8+
ca-certificates \
9+
curl \
10+
gnupg \
11+
lsb-release
12+
mkdir -p /etc/apt/keyrings
13+
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --batch --dearmor -o /etc/apt/keyrings/docker.gpg
14+
echo \
15+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" |
16+
tee /etc/apt/sources.list.d/docker.list >/dev/null
17+
18+
apt-get update
19+
apt install -y docker-ce-cli docker-compose-plugin
20+
21+
groupadd docker
22+
usermod -aG docker node

0 commit comments

Comments
 (0)