-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (23 loc) · 750 Bytes
/
Dockerfile
File metadata and controls
34 lines (23 loc) · 750 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
34
# Use the official golang image as a base
FROM golang:1.21 AS builder
# Set the working directory inside the container
WORKDIR /app
# Copy the Go modules manifests
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
RUN go mod tidy
# Copy the source code into the container
COPY . .
# Build the Go application
RUN CGO_ENABLED=0 GOOS=linux go build -o mender-usercreate .
# Use a minimal base image for the runtime
FROM alpine:latest
# Set the working directory inside the container
WORKDIR /root/
# Copy the built executable from the builder stage
COPY --from=builder /app/mender-usercreate .
# Expose the port that your application listens on (if any)
EXPOSE 8080
# Command to run the executable
CMD ["./mender-usercreate"]