cerebry commited on
Commit
2f734ec
·
1 Parent(s): a5509a5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -11
Dockerfile CHANGED
@@ -1,18 +1,23 @@
 
1
  FROM golang:1.21
2
 
3
- WORKDIR /usr/src/app
4
- # Copy the local package files to the container's workspace.
5
- ADD . /app
6
 
7
- # Download and install the chisel package
8
- RUN go get -v github.com/jpillora/chisel
9
- RUN go install github.com/jpillora/chisel@latest
 
 
 
 
 
 
 
 
10
 
11
  # Expose port 8080 for the chisel server
12
  EXPOSE 8080
13
 
14
- # Run the chisel command when the container starts.
15
- ENTRYPOINT ["chisel"]
16
-
17
- # Set default arguments for chisel
18
- CMD ["server", "--port", "8080"]
 
1
+ # Use an official golang runtime as a parent image
2
  FROM golang:1.21
3
 
4
+ # Set the working directory in the container to /app
5
+ WORKDIR /app
 
6
 
7
+ # Copy go.mod and go.sum files to the workspace
8
+ COPY go.mod go.sum ./
9
+
10
+ # Download all dependencies. They will be cached if the go.mod and go.sum files are not changed
11
+ RUN go mod download
12
+
13
+ # Copy the source code into the container
14
+ COPY . .
15
+
16
+ # Build the application
17
+ RUN go build -o /usr/local/bin/chisel github.com/jpillora/chisel
18
 
19
  # Expose port 8080 for the chisel server
20
  EXPOSE 8080
21
 
22
+ # Command to run the executable
23
+ CMD ["chisel", "server", "--port", "8080"]