forked from ahelmy/xdev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (22 loc) · 666 Bytes
/
Dockerfile
File metadata and controls
31 lines (22 loc) · 666 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
# Stage 1: Build the application
FROM golang:1.20.12-alpine AS builder
WORKDIR /app
# Copy the go.mod and go.sum files to the working directory
COPY go.mod go.sum ./
# Download Go module dependencies
RUN go mod download
# Copy the rest of the application code to the working directory
COPY . .
# Build the Go application
RUN go build -o xdev
# Stage 2: Create a minimal runtime image
FROM alpine:3.19.0
ENV PORT=8000
WORKDIR /app
# Copy the built application from the previous stage
COPY --from=builder /app/xdev .
COPY entrypoint.sh .
# Expose the port on which the application will run
EXPOSE ${PORT}
# Start the application
ENTRYPOINT ["./entrypoint.sh"]