Skip to content

Commit 116ecac

Browse files
update
1 parent a028e0e commit 116ecac

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

Dockerfile

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
1-
# Stage 1: Build
2-
FROM golang:1.22 AS builder
3-
4-
WORKDIR /app
5-
6-
# Copy Go modules and source files
7-
8-
# Build the Go binary
9-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs=false -o main
10-
11-
RUN go mod download
12-
13-
14-
RUN ls -la
15-
16-
RUN pwd
17-
18-
# Stage 2: Package
191
FROM alpine:latest
202

21-
# Copy the built binary from the builder stage
22-
COPY --from=builder /app/main .
3+
# Copy only the required directories and files
4+
COPY main ./main
5+
236

24-
# Give execution permissions
25-
RUN chmod +x /main
7+
RUN chmod 777 /main
268

27-
# Expose the application port
289
EXPOSE 8000
2910

30-
# Command to run the application
31-
CMD ["/main"]
11+
CMD ["/main"]

0 commit comments

Comments
 (0)