Skip to content

Commit d494986

Browse files
committed
feat : add dockerfile to build and run in container
1 parent 5e04fcc commit d494986

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [Unreleased]
4+
5+
### Added
6+
7+
* Add Dockerfile to build and run the application in a container
8+
39
## [1.7.0] - 2024-11-24
410

511
### Added

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Stage 1: Build the application
2+
FROM golang:1.23-alpine AS builder
3+
4+
ARG VERSION=v1.7.0
5+
ARG URL=https://github.com/LordPax/go-scan2epub
6+
7+
WORKDIR /app
8+
9+
RUN apk add --no-cache git && \
10+
git clone --branch ${VERSION} ${URL} . && \
11+
go mod download && \
12+
go build -o scan2epub
13+
14+
# Stage 2: Create the final lightweight image
15+
FROM alpine:latest
16+
17+
RUN apk add --no-cache ca-certificates
18+
19+
WORKDIR /
20+
21+
COPY --from=builder /app/scan2epub /scan2epub
22+
23+
RUN mkdir books
24+
25+
VOLUME ["/root/.config/scan2epub", "/books"]
26+
27+
CMD ["/scan2epub", "inter"]

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ default="onepiece"
5454
name="One Piece"
5555
author="Echiro Oda"
5656
url="https://lelscans.net/mangas/one-piece/{chap}/{page}.{ext}"
57-
epub_dir="/home/lordpax/Perso/epub/onepiece/"
57+
epub_dir="/home/lordpax/scan2epub"
58+
# epub_dir="/books" # Use this line if you are using docker
5859
file_name="{author} - {name} {chap}.epub"
5960
description="Scan of One Piece generated by scan2epub"
6061

@@ -88,3 +89,31 @@ cron_chap=1132
8889
* `{author}`: Author of the manga
8990
* `{name}`: Name of the manga
9091
* `{chap}`: Chapter number
92+
93+
## Docker
94+
95+
1. Build the image:
96+
97+
```bash
98+
docker build -t scan2epub .
99+
```
100+
101+
2. Run the container:
102+
103+
```bash
104+
docker run -d --rm --name test -v ./config:/root/.config/scan2epub -v ./books:/books scan2epub:latest
105+
```
106+
107+
## Docker compose
108+
109+
```yaml
110+
version: '3.7'
111+
112+
services:
113+
scan2epub:
114+
image: scan2epub:latest
115+
container_name: scan2epub
116+
volumes:
117+
- ./config:/root/.config/scan2epub
118+
- ./books:/books
119+
```

0 commit comments

Comments
 (0)