Skip to content

Commit

Permalink
dockerizing (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
xyb committed Jan 2, 2023
1 parent 2e5b18e commit 623fdaa
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
.pytest_cache
**/__pycache__
*.sqlite3
*env
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3

ENV PYTHONUNBUFFERED 1

WORKDIR /app
COPY ./requirements.txt /app/
RUN pip install --no-cache-dir \
--trusted-host mirrors.aliyun.com \
-i https://mirrors.aliyun.com/pypi/simple/ \
-r requirements.txt
ADD . /app
EXPOSE 8000
CMD python manage.py migrate && python manage.py runserver 0.0.0.0:8000
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
# drf_passwordless_jwt
# drf_passwordless_jwt

```sh
$ docker build -t auth .
$ docker run --rm -p 8000:8000 -e EMAIL_BACKEND_TEST=1 auth

$ curl -X POST -d "[email protected]" localhost:8000/auth/email/
{"detail":"A login token has been sent to your email."}

Enter this token to sign in: 527389

$ curl -X POST -d "[email protected]&token=527389" localhost:8000/auth/jwt/
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Inh5YkB0ZXN0LmNvbSIsImV4cCI6MTY3NTI2Njg0NH0.a7RgJLEbeFSQeFZ93qjC2iHo_wabglwzBZ9fe9D-rfw","email":"[email protected]"}

$ curl -X POST -d "token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Inh5YkB0ZXN0LmNvbSIsImV4cCI6MTY3NTI2Njg0NH0.a7RgJLEbeFSQeFZ93qjC2iHo_wabglwzBZ9fe9D-rfw" localhost:8000/auth/
{"email":"[email protected]","exp":"2023-02-01T15:54:04Z"}
```

0 comments on commit 623fdaa

Please sign in to comment.