A solution for interact with docker api local with a simple web server for listen events from github webhook
The golang app interact with the docker api for search and stop the containers with a specific label (projectName
& pullRequestNumber
).
This labeling is mandatory for the containers that you want to detain.
- Docker Engine ❤️
- Go 1.17
You only run this command in your terminal:
docker run -p :8080 \
-v /var/run/docker.sock:/var/run/docker.sock \
-e GITHUB_CLIENT_SECRET=YOUR_WEBHOOK_SECRET \
ghcr.io/enriquetejeda/github-webhook-docker-stop:latest
- Rename the
.env.example
to.env
and configure the values - Compile with the command
make build
- Run the command
make run
I provided a makefile for do this job, only run this command:
make build
I provided a makefile for do this job, only run this command:
make build-docker
Name | Description | Default | Required |
---|---|---|---|
HOST | The address for init the webhook webserver | 0.0.0.0 |
no |
PORT | The port for the webserver | 8080 |
no |
DOCKER_HOST | The docker api endpoint | unix:///var/run/docker.sock |
no |
GITHUB_CLIENT_SECRET | If you configure a secret for the webhook put here | 123456 |
no |
Please feel free to contribute to this project, please fork the repository and make a pull request!. ❤️
Like this project? Please give it a ★ on this GitHub! (it helps me a lot).
See LICENSE for full details.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.