diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4996f9d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:1.22 AS build +WORKDIR /app +COPY go.mod go.sum ./ +RUN go mod download && go mod verify +COPY *.go . +COPY common/ common/ +COPY client/ client/ +COPY server/ server/ +RUN go build -v -o ./archat-server . + +FROM ubuntu:noble +WORKDIR /app +COPY --from=build /app/archat-server /app/archat-server +CMD ["./archat-server", "--run", "server"] diff --git a/README.md b/README.md index 4f26ab5..11571ef 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,18 @@ go run . --run server --waddr krzyzanowski.dev:8080 --uaddr krzyzanowski.dev:808 `--waddr` and `--uaddr` options are optional, default values are respectively `:8080` and `:8081` (which is a short form of `localhost:8080` and `localhost:8081`) `--run` option is mandatory and may take value of either `client` or `server` + +## Running using Docker +You are provided with Dockerfile inside this repository. You can use it to build your image and run archat-server +in a container. This image does not allow to run client, because it does not make sense. + +0. Enter the top directory of this repository (using cd) +1. Start with building image +```bash +docker build -t archat-server . +``` +2. Now run a container +```bash +docker run -d -p 8080-8081:8080-8081 archat-server +``` +You may change exposed ports according to your needs, just remember that they need to be open. Also, be sure to build an image after any code update :) \ No newline at end of file