-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (35 loc) · 935 Bytes
/
Copy pathDockerfile
File metadata and controls
49 lines (35 loc) · 935 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Build stage
FROM golang:1.21-alpine AS build
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache git
# Copy go.mod and go.sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy the source code
COPY . .
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o projectflow
# Final stage
FROM alpine:latest
WORKDIR /app
# Install runtime dependencies
RUN apk --no-cache add ca-certificates tzdata
# Copy the binary from the build stage
COPY --from=build /app/projectflow /app/projectflow
# Copy migrations
COPY --from=build /app/database/migrations /app/database/migrations
# Expose the port
EXPOSE 8080
# Set environment variables
ENV DB_HOST=postgres \
DB_PORT=5432 \
DB_USER=postgres \
DB_PASSWORD=postgres \
DB_NAME=projectflow \
SERVER_PORT=8080 \
JWT_SECRET=your-secret-key \
ENV=development
# Run the application
CMD ["/app/projectflow"]