diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..42fd9b35 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# Use an official Golang image as a base# Use an official Golang image as a base +FROM golang:latest + +# Set the working directory +WORKDIR /app + +# Copy the local repository files to the Docker container +COPY . /app + +# Copy the pre-generated certificates from the host +COPY configs/certs/key.pem /app/configs/certs/key.pem +COPY configs/certs/cert.pem /app/configs/certs/cert.pem + +# Run the Go server +CMD ["go", "run", "cmd/server/main.go"] + +# Expose the port +EXPOSE 8086 \ No newline at end of file diff --git a/README.md b/README.md index b2f769aa..90006f43 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,13 @@ brew install golang go run cmd/server/main.go ``` +- Run with Docker + +```bash +docker build -t flutter-webrtc-server . +docker run -d --name flutter-webrtc-server-container -p 8086:8086 flutter-webrtc-server +``` + - Open https://0.0.0.0:8086 to use flutter web demo. - If you need to test mobile app, please check the [webrtc-flutter-demo](https://github.com/cloudwebrtc/flutter-webrtc-demo).