Skip to content

PR for Dockerfile #91

Open
Open
@1993alexey

Description

@1993alexey

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

  1. CD into the project
  2. Run docker build -t webrtc-server:1.0.0 . to create an image
  3. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions