Skip to content

Commit db5ea99

Browse files
committed
feat: Dockerfile: Refactor Dockerfile for smaller image size
1 parent 9127838 commit db5ea99

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

Dockerfile

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
FROM golang:1.24-alpine as builder
2-
RUN apk update && apk upgrade && apk add --no-cache bash git openssh
3-
WORKDIR /app
4-
COPY go.mod go.sum ./
5-
RUN go mod download
1+
FROM golang:1.24-alpine AS builder
2+
3+
WORKDIR /root/go/
64
COPY . .
7-
RUN go build -o main .
5+
RUN apk --no-cache add make git gcc libtool musl-dev ca-certificates dumb-init curl
6+
RUN go get .
7+
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o divar-alert .
8+
9+
10+
FROM alpine:3.17
11+
LABEL org.opencontainers.image.source="https://github.com/MrMohebi/stremio-ir-providers"
12+
13+
WORKDIR /root/app
814

15+
COPY --from=builder --chmod=777 /root/go/divar-alert ./divar-alert
916

10-
FROM python:alpine3.16
11-
RUN apk update && apk add --no-cache ffmpeg
12-
COPY --from=builder /app/main /
13-
CMD ["./main"]
17+
ENTRYPOINT ["/root/app/divar-alert"]

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ services:
66
environment:
77
- TELEGRAM_BOT_TOKEN=
88
- TELEGRAM_API_URL=https://tapi.bale.ai
9-
- DB_PATH=./db.badger
9+
- DB_PATH=/root/app/db.badger
1010
volumes:
11-
- ./db.badger:/db.badger
11+
- ./db.badger:/root/app/db.badger

0 commit comments

Comments
 (0)