Skip to content

Commit decaba3

Browse files
committed
Add GitHub Actions workflow for Docker image CI
1 parent 28cbcba commit decaba3

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

.github/workflows/docker-build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Build and tag the Docker image
17+
run: |
18+
docker build . --file Dockerfile --tag doh-server:latest
19+
# If you want to push to Docker Hub, uncomment the following lines
20+
# and ensure DOCKER_USERNAME and DOCKER_PASSWORD are set as GitHub Secrets.
21+
# echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
22+
# docker tag doh-server:latest your_dockerhub_username/doh-server:latest
23+
# docker push your_dockerhub_username/doh-server:latest

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# doh-server
2+
3+
This repository contains a Dockerized DNS-over-HTTPS (DoH) server, built using `dnscrypt/doh-server`. It provides a simple way to run your own DoH resolver.
4+
5+
## Table of Contents
6+
7+
* [Getting Started](#getting-started)
8+
* [Building the Docker Image](#building-the-docker-image)
9+
* [Running the Docker Container](#running-the-docker-container)
10+
* [Usage](#usage)
11+
* [GitHub Actions CI/CD](#github-actions-cicd)
12+
13+
## Getting Started
14+
15+
To run this DoH server, you will need [Docker](https://www.docker.com/get-started/) installed on your system.
16+
17+
## Building the Docker Image
18+
19+
You can build the Docker image locally using the provided `Dockerfile`:
20+
21+
```bash
22+
docker build -t doh-server:latest .
23+
```
24+
25+
This command will create a Docker image named `doh-server` with the tag `latest`.
26+
27+
## Running the Docker Container
28+
29+
Once the image is built, you can run the DoH server in a Docker container:
30+
31+
```bash
32+
docker run -d -p 8053:8053 --name doh-server doh-server:latest
33+
```
34+
35+
* `-d`: Runs the container in detached mode (in the background).
36+
* `-p 8053:8053`: Maps port `8053` on your host machine to port `8053` inside the container. The `doh-server` listens on port `8053` by default.
37+
* `--name doh-server`: Assigns a name to your container for easier management.
38+
39+
## Usage
40+
41+
After the container is running, the DoH server will be accessible on `http://localhost:8053`. You can test it using `curl`:
42+
43+
```bash
44+
curl -H 'accept: application/dns-json' 'http://localhost:8053/dns-query?dns=q80BAAABAAAAAAAAA3d3dwdleGFtcGxlA2NvbQAAAQAB'
45+
```
46+
47+
This command queries for `www.example.com` using the DoH server.
48+
49+
## GitHub Actions CI/CD
50+
51+
This repository includes a GitHub Actions workflow (`.github/workflows/docker-build.yml`) that automatically builds the Docker image whenever changes are pushed to the `main` branch. This ensures that your Docker image is always up-to-date with the latest code.

0 commit comments

Comments
 (0)