Update Dockerfile
Browse files- Dockerfile +7 -12
Dockerfile
CHANGED
|
@@ -1,14 +1,13 @@
|
|
| 1 |
# Stage 1: Build the application
|
| 2 |
FROM golang:1.22 AS builder
|
| 3 |
|
| 4 |
-
# Set the working directory inside the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Copy go.mod and go.sum
|
| 8 |
COPY go.mod go.sum ./
|
| 9 |
RUN go mod download
|
| 10 |
|
| 11 |
-
# Copy
|
| 12 |
COPY . .
|
| 13 |
|
| 14 |
# Build the application binary
|
|
@@ -17,23 +16,19 @@ RUN go build -o go_jackett main.go
|
|
| 17 |
# Stage 2: Create a minimal runtime container
|
| 18 |
FROM debian:bullseye-slim
|
| 19 |
|
| 20 |
-
# Set the working directory
|
| 21 |
WORKDIR /app
|
| 22 |
|
| 23 |
-
# Install
|
| 24 |
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
| 25 |
|
| 26 |
-
# Copy the binary
|
| 27 |
COPY --from=builder /app/go_jackett /app/
|
| 28 |
-
COPY --from=builder /app/.env /app/
|
| 29 |
-
COPY --from=builder /app/persistence /app/persistence
|
| 30 |
-
COPY --from=builder /app/temp /app/temp
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
|
| 34 |
|
| 35 |
# Expose the application port
|
| 36 |
EXPOSE 3000
|
| 37 |
|
| 38 |
-
#
|
| 39 |
CMD ["./go_jackett"]
|
|
|
|
| 1 |
# Stage 1: Build the application
|
| 2 |
FROM golang:1.22 AS builder
|
| 3 |
|
|
|
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
+
# Copy go.mod and go.sum and download dependencies
|
| 7 |
COPY go.mod go.sum ./
|
| 8 |
RUN go mod download
|
| 9 |
|
| 10 |
+
# Copy application code
|
| 11 |
COPY . .
|
| 12 |
|
| 13 |
# Build the application binary
|
|
|
|
| 16 |
# Stage 2: Create a minimal runtime container
|
| 17 |
FROM debian:bullseye-slim
|
| 18 |
|
|
|
|
| 19 |
WORKDIR /app
|
| 20 |
|
| 21 |
+
# Install necessary runtime dependencies
|
| 22 |
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
| 23 |
|
| 24 |
+
# Copy the built binary from the builder stage
|
| 25 |
COPY --from=builder /app/go_jackett /app/
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
# Copy the .env file for configuration (if needed)
|
| 28 |
+
COPY .env /app/.env
|
| 29 |
|
| 30 |
# Expose the application port
|
| 31 |
EXPOSE 3000
|
| 32 |
|
| 33 |
+
# Default command to run the application
|
| 34 |
CMD ["./go_jackett"]
|