-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
38 lines (26 loc) · 846 Bytes
/
Dockerfile
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
# Start from base image
FROM golang:1.18-alpine as build
# Set the current working directory inside the container
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download all dependencies
RUN go mod download
# Copy source from current directory to working directory
COPY . .
# Build the application
# Produce binary named main
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -a -o main cmd/main.go
########################
# Start from a new lightweight image
FROM alpine:latest
# Install ffmpeg and imagemagick
RUN apk --no-cache add ffmpeg imagemagick
# Set the working directory inside the container
WORKDIR /app
# Copy the binary from the build image to the working directory
COPY --from=build /app/main .
# Run the binary
ENTRYPOINT ["./main"]
# Set default arguments
CMD ["-i", "input.mp4"]