Add docker image
This commit is contained in:
parent
81115dbc76
commit
3b2de6f973
3 changed files with 57 additions and 19 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
_build/
|
||||
/docker-compose.yml
|
||||
|
||||
/selenium-*.jar
|
||||
/gecko-*.tar.gz
|
||||
|
|
24
Dockerfile
Normal file
24
Dockerfile
Normal file
|
@ -0,0 +1,24 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM ocaml/opam:alpine-3.17-ocaml-4.14 AS builder
|
||||
WORKDIR /usr/src/pusk
|
||||
COPY . .
|
||||
|
||||
USER root
|
||||
RUN apk add gmp-dev pcre-dev && \
|
||||
chown -R opam:opam .
|
||||
|
||||
USER opam
|
||||
RUN opam install -y dune cohttp-lwt-unix dotenv twostep lwt_ssl && \
|
||||
eval $(opam env) && \
|
||||
dune install
|
||||
|
||||
FROM alpine:3.17
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add dumb-init firefox libc6-compat pcre-dev
|
||||
|
||||
COPY --from=builder /usr/src/pusk/_build/install/default/bin/pusk /app/pusk
|
||||
|
||||
CMD ["dumb-init", "./pusk"]
|
51
README.md
51
README.md
|
@ -2,29 +2,42 @@
|
|||
|
||||
Send a tweet to prevent Twitter from closing your account.
|
||||
|
||||
## Requirements
|
||||
## How to use?
|
||||
|
||||
```opam
|
||||
$ opam switch list
|
||||
# switch compiler description
|
||||
→ default ocaml-base-compiler.4.14.1 default
|
||||
## With Docker
|
||||
|
||||
You can use this dockercompose template:
|
||||
|
||||
```yaml
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
pusk:
|
||||
build: .
|
||||
container_name: Pusk
|
||||
environment:
|
||||
- TWITTER_USERNAME=yourusername # not your mail
|
||||
- TWITTER_PASSWORD=yourpassword
|
||||
- TWITTER_TOTP=yourseed # optional if you don't have 2fa
|
||||
- PUSK_DEBUG=false # optional
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
```sh
|
||||
$ opam install cohttp-lwt-unix tls-lwt dotenv twostep
|
||||
```
|
||||
## Local
|
||||
|
||||
- You will need these dependencies:
|
||||
|
||||
```sh
|
||||
$ opam install cohttp-lwt-unix tls-lwt dotenv twostep lwt_ssl
|
||||
```
|
||||
|
||||
- Populate your credentials in [config/.env](./config/.env)
|
||||
- Then you can run the bot with:
|
||||
|
||||
```sh
|
||||
$ dune exec pusk
|
||||
```
|
||||
|
||||
## Name history
|
||||
|
||||
Derived from Elon's name :D. Thanks, Elon, for destroying Twitter.
|
||||
|
||||
## TODO list
|
||||
|
||||
- [x] Download a driver
|
||||
- [x] Run a driver in background during the life of the app
|
||||
- [x] [Figuring out how to use drivers](https://w3c.github.io/webdriver/#endpoints)
|
||||
- [x] Login to Twitter.com
|
||||
- [x] Check if latest tweet of user is more or less old than 30 days
|
||||
- [x] Then tweet if needed something like "Don't delete my account please"
|
||||
- [x] Close everything properly
|
||||
- [ ] Maybe create a docker image for easy deployment?
|
||||
|
|
Loading…
Reference in a new issue