Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions S3-Keploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Multi-stage build for optimized image size
FROM golang:1.21-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o app .

# Final stage - runtime image
FROM alpine:3.18
WORKDIR /app
RUN apk --no-cache add ca-certificates
COPY --from=builder /app/app .
EXPOSE 3000
CMD ["./app"]
47 changes: 46 additions & 1 deletion S3-Keploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,53 @@ A simple CRUD application to showcase Keploy integration capabilities using [Go-

1. [Go](https://go.dev/doc/install)
2. [AWS Access Key and Security Key](https://aws.github.io/aws-sdk-go-v2/docs/getting-started/#get-your-aws-access-keys)
3. [Docker](https://docs.docker.com/engine/install/) (optional, for containerized deployment)

## Running app on Ubuntu 22.04.03 LTS
## Running app using Docker

Keploy can be used on Linux, Windows and MacOS through [Docker](https://docs.docker.com/engine/install/).

> Note: To run Keploy on MacOS through [Docker](https://docs.docker.com/desktop/release-notes/#4252) the version must be ```4.25.2``` or above.

### Setting aws credentials

Before running the app, ensure you have AWS credentials configured in your home directory:

```bash
mkdir -p ~/.aws
cat > ~/.aws/credentials << EOF
[default]
aws_access_key_id = <YOUR_ACCESS_KEY_ID>
aws_secret_access_key = <YOUR_SECRET_ACCESS_KEY>
EOF
```

### Setup and build the application

```bash
git clone https://github.com/keploy/samples-go.git && cd samples-go/S3-Keploy
docker build -t s3-keploy-app:1.0 .
```

### Using docker-compose

Alternatively, you can use docker-compose to run the application:

```bash
# Create the external network if it doesn't exist
docker network create keploy-network

# Start the application
docker-compose up
```

### Capture the Testcases

```shell
keploy record -c "docker run -p 3000:3000 --name s3KeployApp --network keploy-network -v ~/.aws:/root/.aws:ro s3-keploy-app:1.0"
```

## Running app on Ubuntu 22.04.03 LTS (without Docker)

### Setting aws credentials

Expand Down
17 changes: 17 additions & 0 deletions S3-Keploy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.9"
services:
go-app:
build:
context: .
container_name: s3KeployApp
ports:
- "3000:3000"
volumes:
# Mount AWS credentials from host machine
- ~/.aws:/root/.aws:ro
networks:
- keploy-network

networks:
keploy-network:
external: true
Loading