Open
Description
I wanted to submit a PR, but I don't have access to push new branches. Here is a multi-stage docker build file that takes into account certificates
FROM golang:1.19 AS base
# Set destination for COPY
WORKDIR /app
# Download Go modules
COPY go.mod go.sum ./
RUN go mod download
# Copy the source code
COPY cmd ./cmd/
COPY pkg ./pkg/
# Build
RUN CGO_ENABLE=0 GOOS=linux go build -o bin/webrtc-server -ldflags "-s -w" cmd/server/main.go
# Discard the sourcecode and only keep configs and the executable in the final stage
FROM golang:1.19
WORKDIR /app
COPY --from=base /app/bin/webrtc-server ./bin/webrtc-server
COPY configs/config.ini ./configs/
COPY web ./web/
# Document the running port
EXPOSE 8086
# Run
CMD ["bin/webrtc-server"]
Below are the readme instructions I was planning to add
Docker
- CD into the project
- Run
docker build -t webrtc-server:1.0.0 .
to create an image - Run the image
docker run -p 8086:8086 -v $(pwd)/configs/certs:/app/configs/certs webrtc-server:1.0.0
P.S. If running on windows, replace $(pwd)
with the absolute path
Metadata
Metadata
Assignees
Labels
No labels