From c2c030fb4be52336a6e5ab71fede805e836b6d98 Mon Sep 17 00:00:00 2001 From: Dominic Ricottone Date: Sat, 11 Nov 2023 20:16:55 -0600 Subject: [PATCH] Updates and reorganization Updated dependency and go versions. Reworked the Makefile recipes. Extracted the container image recipe from this repository. See https://git.dominic-ricottone.com/~dricottone/container-images/tree/dev/item/simple-chat/README.md . --- Dockerfile | 12 ------------ Makefile | 15 +++------------ server/Makefile | 16 +++++++++++----- server/go.mod | 9 ++++++--- 4 files changed, 20 insertions(+), 32 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 1104ed7..0000000 --- a/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM golang:alpine - -WORKDIR /app -COPY server/* ./ -RUN go mod download -RUN go build -o /app/server-bin - -EXPOSE 8080 -RUN adduser -H -D -u 1001 me -USER me:me -CMD [ "/app/server-bin" ] - diff --git a/Makefile b/Makefile index 4884ab8..3972e7b 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,4 @@ -CONMAN=sudo docker - -.PHONY: clean -clean: - $(CONMAN) image rm --force my-chat || true - - -.PHONY: image -image: - #cd server && make build - $(CONMAN) build --tag my-chat . - +server: + cd server && make clean && make go.mod && make server +.PHONY: server diff --git a/server/Makefile b/server/Makefile index ded6be0..666564f 100644 --- a/server/Makefile +++ b/server/Makefile @@ -1,9 +1,15 @@ -.PHONY: clean clean: - rm -f server go.sum + rm -f server + rm -f go.mod -.PHONY: build -build: clean - go get -u +go.mod: + go mod init git.dominic-ricottone.com/~dricottone/simple-chat/server + go get github.com/gorilla/websocket + +server: + go mod download go build +build: server + +.PHONY: clean build diff --git a/server/go.mod b/server/go.mod index d23c73b..88a236f 100644 --- a/server/go.mod +++ b/server/go.mod @@ -1,5 +1,8 @@ -module git.dominic-ricottone.com/simple-chat/server +module git.dominic-ricottone.com/~dricottone/simple-chat/server -go 1.18 +go 1.21.4 -require github.com/gorilla/websocket v1.5.0 +require ( + github.com/gorilla/websocket v1.5.1 // indirect + golang.org/x/net v0.17.0 // indirect +) -- 2.45.2