-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (24 loc) · 855 Bytes
/
Dockerfile
File metadata and controls
35 lines (24 loc) · 855 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
# Use the official Golang image as the base image
FROM golang:1.26.1-alpine AS build
# Set the working directory inside the container
WORKDIR /app
# Copy the Go mod and sum files to the working directory
COPY go.mod go.sum ./
# Download and install dependencies
RUN go mod download
# Copy the source code into the container
COPY . .
# Build the application
RUN go build -o mega-backuper
# Start a new stage using a minimal Alpine image
FROM alpine:latest
# Install postgresql-client and mariadb-client for native dumps
RUN apk add --no-cache postgresql-client mariadb-client
# Set the working directory inside the container
WORKDIR /app
# Copy the built binary from the previous stage
COPY --from=build /app/mega-backuper .
# Copy mega-backuper.json
COPY backuper.json /app/backuper.json
# Command to run the application
CMD ["./mega-backuper"]