Skip to content

Commit e180a79

Browse files
author
Lapp
committed
project: added docker file. Makefile: added build image app and run container
1 parent 6fc58f7 commit e180a79

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM golang:1.16.4-alpine3.13 AS builder
2+
3+
COPY ./ /github.com/Lapp-coder/websocket-chat
4+
WORKDIR /github.com/Lapp-coder/websocket-chat
5+
6+
RUN go mod download
7+
RUN go build -o ./build/bin/chat ./...
8+
9+
FROM alpine:latest
10+
11+
WORKDIR /opt/
12+
13+
COPY --from=builder /github.com/Lapp-coder/websocket-chat/build/bin/chat .
14+
15+
EXPOSE 8080
16+
17+
CMD ["./chat"]

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@ build:
66

77
run: build
88
./main
9+
10+
docker-build:
11+
docker build -t websocket-chat .
12+
13+
docker-run: docker-build
14+
docker run --name=chat -e CHAT_HOST=0.0.0.0 -e CHAT_PORT=8080 -p 8080:8080 --rm websocket-chat

0 commit comments

Comments
 (0)