Skip to content

Commit

Permalink
Docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
SijmenHuizenga committed Sep 11, 2020
1 parent fc2db69 commit 47487be
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM golang:1.12 as builder

WORKDIR /project
COPY main.go go.mod go.sum ./
COPY downloader ./downloader
ADD vendor ./vendor
ADD version ./version

# Production-ready build, without debug information specifically for linux
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o=gitmoo-goog -mod=vendor .


FROM alpine:3.12

# Add CA certificates required for SSL connections
RUN apk add --update --no-cache ca-certificates

COPY --from=builder /project/gitmoo-goog /usr/local/bin/gitmoo-goog

RUN mkdir /app
WORKDIR /app
ENTRYPOINT ["/usr/local/bin/gitmoo-goog"]
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,27 @@ Logfile will be saved as `gitmoo.log`.
Files are created as follows:

`[folder][year][month][day]_[hash].json` and `.jpg`. The `json` file holds the metadata from `google-photos`.

## Docker (Linux only)

You can run gitmoo-goog in Docker. At the moment you have to build the image yourself. After cloning the repo run:

```
$ docker build -t dtylman/gitmoo-goog:latest .
```

Now run gitmoo-goo in Docker:

```
$ docker run -v $(pwd):/app --user=$(id -u):$(id -g) dtylman/gitmoo-goog:latest
```

Replace `$(pwd)` with the location of your storage directory on your computer.
Within the storage directory gitmoo-goog expects the `credentials.json` and will place all the downloaded files.

The part `--user=$(id -u):$(id -g)` ensures that the downloaded files are owned by the user launching the container.

Configuring additional settings is possible by adding command arguments like so:
```
$ docker run -v $(pwd):/app --user=$(id -u):$(id -g) dtylman/gitmoo-goog:latest -loop -throttle 45
```

0 comments on commit 47487be

Please sign in to comment.