Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +16 -11
Dockerfile
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
|
|
| 1 |
FROM golang:1.21
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
ADD . /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Expose port 8080 for the chisel server
|
| 12 |
EXPOSE 8080
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 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"]
|
|
|
|
|
|
|
|
|