From 3e1e9df70d2d2f5ee0ef5ae32fe11bfe2418f9be Mon Sep 17 00:00:00 2001 From: dimaioksha Date: Sat, 18 May 2024 22:48:14 +0300 Subject: [PATCH] Add dockerfile --- .gitignore | 1 + README.md | 11 +++++++++++ docker/Dockerfile | 13 +++++++++++++ docker/docker-compose.yml | 15 +++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/docker-compose.yml diff --git a/.gitignore b/.gitignore index 3e8c470..dc2e364 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ yarn-error.log* # local env files # do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables +.idea/ .env .env*.local diff --git a/README.md b/README.md index 343ef3d..aae4719 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,17 @@ Special thanks to [Diagram](https://diagram.com/) for sponsorship and guidance. https://user-images.githubusercontent.com/1443449/222598119-0a5a536e-6785-44ad-ba28-e26e04f15163.mp4 +## Getting started + +You can manually build `Tiktokenizer` using Docker: + +```bash +echo "HF_API_KEY=" >> .env +docker compose -f docker/docker-compose.yml up -d +``` + +After execution you will be able to see working application at `localhost:3000` + ## Acknowledgments - [T3 Stack](https://create.t3.gg/) diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..9adc589 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,13 @@ +FROM node:22.2.0-slim + +ARG HF_API_KEY +ARG NODE_ENV +WORKDIR /app + +COPY yarn.lock package.json ./ +RUN yarn install + +COPY . . +RUN yarn build + +CMD ["yarn", "start"] \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..58bf6ef --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,15 @@ +version: "3.9" + +services: + tiktokenizer: + build: + context: ../ + dockerfile: docker/Dockerfile + args: + HF_API_KEY: ${HF_API_KEY} + NODE_ENV: "development" + ports: + - "3000:3000" + environment: + HF_API_KEY: ${HF_API_KEY} + NODE_ENV: "production" \ No newline at end of file