mirror of
https://github.com/adulau/mastodon-markdown-archive.git
synced 2024-11-21 09:27:05 +00:00
Add a Dockerfile and update README
This commit is contained in:
parent
797ccfcb6d
commit
f2b07a5516
3 changed files with 54 additions and 1 deletions
1
.dockerignore
Normal file
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
justfile
|
25
Dockerfile
Normal file
25
Dockerfile
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
FROM golang:1.23.0-alpine3.20 AS build
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY go.mod go.sum .
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
ENV CGO_ENABLED=0
|
||||||
|
ENV GOOS=linux
|
||||||
|
|
||||||
|
RUN go build -o mastodon-markdown-archive
|
||||||
|
|
||||||
|
FROM alpine:3.20
|
||||||
|
RUN apk add --no-cache ca-certificates
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.title="Mastodon Markdown Archive"
|
||||||
|
LABEL org.opencontainers.image.description="Archive Mastodon posts as markdown files"
|
||||||
|
LABEL org.opencontainers.image.vendor="Gabriel Garrido"
|
||||||
|
LABEL org.opencontainers.image.licenses=MIT
|
||||||
|
LABEL org.opencontainers.image.url=https://git.garrido.io/gabriel/mastodon-markdown-archive
|
||||||
|
LABEL org.opencontainers.image.source=https://git.garrido.io/gabriel/mastodon-markdown-archive
|
||||||
|
LABEL org.opencontainers.image.documentation=https://git.garrido.io/gabriel/mastodon-markdown-archive
|
||||||
|
|
||||||
|
COPY --from=build /app/mastodon-markdown-archive /usr/bin/mastodon-markdown-archive
|
||||||
|
ENTRYPOINT ["/usr/bin/mastodon-markdown-archive"]
|
29
README.md
29
README.md
|
@ -49,10 +49,37 @@ It is likely that I have not considered all possible use cases, or that I've bee
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
### From source
|
||||||
|
|
||||||
[Go](https://go.dev/doc/install) is required for installation.
|
[Go](https://go.dev/doc/install) is required for installation.
|
||||||
|
|
||||||
You can clone this repo and run `go build main.go` in the repository's directory, or you can run `go install git.garrido.io/gabriel/mastodon-markdown-archive@latest` to install a binary of the latest version.
|
You can clone this repo and run `go build main.go` in the repository's directory, or you can run `go install git.garrido.io/gabriel/mastodon-markdown-archive@latest` to install a binary of the latest version.
|
||||||
|
|
||||||
|
### Container
|
||||||
|
|
||||||
|
A [Dockerfile](./Dockerfile) is included in this repository.
|
||||||
|
|
||||||
|
An image can be built as follows:
|
||||||
|
|
||||||
|
`docker build -t mastodon-markdown-archive .`
|
||||||
|
|
||||||
|
A host folder should be mounted into the container so that the files generated by the container are persisted to the host's file system. You can run the tool as follows:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run --rm -v ~/posts:/posts mastodon-markdown-archive \
|
||||||
|
--user=https://social.coop/@ggpsv \
|
||||||
|
--dist=/posts \
|
||||||
|
--exclude-replies \
|
||||||
|
--exclude-reblogs \
|
||||||
|
--persist-last=./last \
|
||||||
|
--visibility=public \
|
||||||
|
--download-media=bundle \
|
||||||
|
--threaded=true \
|
||||||
|
--max-id=$(test -f ./last && cat ./last || echo "")
|
||||||
|
```
|
||||||
|
|
||||||
|
The container's volume target (e.g `:/posts`) should match the directory passed to the `--dist` argument.
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
This tool has only two direct dependencies, which are included to provide useful, though largely optional, functionality in templates:
|
This tool has only two direct dependencies, which are included to provide useful, though largely optional, functionality in templates:
|
||||||
|
@ -413,4 +440,4 @@ This is done specifically to support Hugo [page bundles](https://gohugo.io/conte
|
||||||
|
|
||||||
## Known issues
|
## Known issues
|
||||||
|
|
||||||
1. A reply post may still appear in the list of posts despite using `--exclude-replies`. This happens when the post in question is a reply to a post that has since been deleted. It looks like Mastodon's API stops treating the reply as a reply. It no longer points to another post, and thus is not affected by the `exclude_replies` parameter.
|
1. A reply post may still appear in the list of posts despite using `--exclude-replies`. This happens when the post in question is a reply to a post that has since been deleted. It looks like Mastodon's API stops treating the reply as a reply. It no longer points to another post, and thus is not affected by the `exclude_replies` parameter.
|
||||||
|
|
Loading…
Reference in a new issue