Skip to content

Commit

Permalink
Merge pull request #2 from keploy/shivam/releaseDocker
Browse files Browse the repository at this point in the history
add: docker releaser
  • Loading branch information
charankamarapu authored Aug 7, 2024
2 parents 6fb321d + 7635739 commit 6fec737
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 5 deletions.
57 changes: 57 additions & 0 deletions .github/ISSUE_TEMPLATE/--bug-report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Bug report
description: Create a bug report to help us improve Keploy
title: "[bug]: "
labels: [bug]
body:
- type: markdown
attributes:
value: |
Thank you for taking the time to fill out this bug report.
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Current behavior
description: A concise description of what you're experiencing and what you expect
placeholder: |
When I do <X>, <Y> happens and I see the error message attached below:
```...```
What I expect is <Z>
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: Add steps to reproduce this behaviour, include console or network logs and screenshots
placeholder: |
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
validations:
required: true
- type: dropdown
id: env
attributes:
label: Environment
options:
- Production
- Release
- Deploy preview
validations:
required: false
- type: dropdown
id: version
attributes:
label: Version
options:
- Cloud
- Self-hosted
- Local
validations:
required: true
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/--feature-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Feature request
description: Suggest a feature to improve Keploy
title: "[feature]: "
labels: [feature]
body:
- type: markdown
attributes:
value: |
Thank you for taking the time to request a feature for Keploy
- type: checkboxes
attributes:
label: Is there an existing feature request for this?
description: Please search to see if an issue related to this feature request/feature request already exists
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Summary
description: One paragraph description of the feature
validations:
required: true
- type: textarea
attributes:
label: Why should this be worked on?
description: A concise description of the problems or use cases for this feature request
validations:
required: true
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
contact_links:
- name: Help and support
url: https://github.com/keploy/keploy#community-support
about: Reach out to us on our Slack channel or Discourse discussions or GitHub discussions.
- name: Dedicated support
url: mailto:hello@keploy.io
about: Write to us if you'd like dedicated support using Keploy
1 change: 1 addition & 0 deletions .github/License-Apache_2.0-blue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Pull Request Template

## Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

## Additional Context (Please include any Screenshots/gifs if relevant)

...

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] I have checked my code and corrected any misspellings
- [ ] I have tagged the reviewers in a comment below incase my pull request is ready for a review
- [ ] I have signed the commit message to agree to Developer Certificate of Origin (DCO) (to certify that you wrote or otherwise have the right to submit your contribution to the project.) by adding "--signoff" to my git commit command.

<!--- Thanks for opening this pull request! If the tests fail, please feel free to reach out to us by leaving a comment down below and we will be happy to take a look --->
20 changes: 20 additions & 0 deletions .github/slack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions .github/workflows/docker-release-amd64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: DockerReleaseAMD64

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
tags: [ 'v*.*.*' ]


env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: self-hosted
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install Cosign
uses: sigstore/cosign-installer@v3.4.0

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

# Change directory to the projects folder
- name: Change directory to projects folder
run: cd projects

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
15 changes: 10 additions & 5 deletions projects/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ RUN npm install js-yaml # Install js-yaml

# Stage 3: Set up the Python environment
FROM ubuntu:latest as python-builder
RUN apt-get update && apt-get install -y python3 python3-pip python3-venv curl lsof && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y software-properties-common && \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && apt-get install -y python3.12 python3.12-venv python3.12-dev python3-pip curl lsof && \
apt-get clean && rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY python/. ./
RUN python3 -m venv venv && \
RUN python3.12 -m venv venv && \
. venv/bin/activate && \
if [ -f "requirements.txt" ]; then pip install --no-cache-dir -r requirements.txt; fi

Expand Down Expand Up @@ -52,13 +55,15 @@ COPY --from=js-builder /app /app/js-app
COPY --from=js-builder /usr/local/lib/node_modules/nyc /usr/local/lib/node_modules/nyc
RUN ln -s /usr/local/lib/node_modules/nyc/bin/nyc.js /usr/local/bin/nyc

# Copy the Python application code
# Copy the Python application code and virtual environment
COPY --from=python-builder /app /app/python-app
COPY --from=python-builder /app/venv /app/venv

COPY --from=python-builder /usr/local/bin/keploy /usr/local/bin/keploy
RUN chmod +x /usr/local/bin/keploy

ENV PYTHONUNBUFFERED 1
# Set environment variables for Python
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH="/app/python-app/venv/lib/python3.12/site-packages"

CMD ["sleep", "infinity"]
CMD ["sleep", "infinity"]

0 comments on commit 6fec737

Please sign in to comment.