-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (23 loc) · 710 Bytes
/
Copy pathDockerfile
File metadata and controls
33 lines (23 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Start from a Debian-based image with Go installed
FROM golang:1.16
# Set the working directory to /app
WORKDIR /chatapp
# Copy the Go modules file and download dependencies
COPY go.mod .
COPY go.sum .
RUN go mod download
RUN go get golang.org/x/net
RUN go mod tidy
# Copy the rest of the application source code
COPY . .
RUN go mod download golang.org/x/net
# Build the Go chatapp
RUN go build -o main .
# Expose port 8000 for the web server
EXPOSE 8000
# Run the Go app
CMD ["./main"]
# build the Docker image by running the following command
# docker build -t chatapp .
# After the build is complete, you can run the Docker container using the following command:
# docker run -p 8000:8000 chatapp