Official Docker image (#46)

* Initial Dockerfile

* Docker added to Readme

* Added Docker to Travis
This commit is contained in:
David
2021-09-05 16:44:05 +02:00
committed by GitHub
parent 1adbe08056
commit 4df0d40dcf
4 changed files with 92 additions and 1 deletions

50
.dockerignore Normal file
View File

@@ -0,0 +1,50 @@
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel
# IDEs
/.vscode/
/.idea/
# cypress
cypress/videos
cypress/screenshots
# next-pwa
**/public/workbox-*.js*
**/public/sw.js*
**/public/worker-*.js*
# git
.git/
.gitignore
.gitattributes

View File

@@ -7,6 +7,9 @@ os: linux
dist: xenial dist: xenial
services:
- docker
addons: addons:
apt: apt:
packages: packages:
@@ -31,3 +34,10 @@ script:
else else
yarn cy:run; yarn cy:run;
fi' fi'
before_deploy:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
deploy:
provider: script
script: docker push thedaviddelta/lingva-translate

26
Dockerfile Normal file
View File

@@ -0,0 +1,26 @@
# https://nextjs.org/docs/deployment#docker-image
FROM node:alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
FROM node:alpine AS builder
WORKDIR /app
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
COPY --chown=nextjs:nodejs . .
COPY --from=deps /app/node_modules ./node_modules
RUN chown nextjs:nodejs .
USER nextjs
EXPOSE 3000
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
CMD NEXT_PUBLIC_SITE_DOMAIN=$site_domain yarn build && yarn start

View File

@@ -36,6 +36,12 @@ The easiest way is to use their creators' own platform, [Vercel](https://vercel.
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2FTheDavidDelta%2Flingva-translate%2Ftree%2Fmain&env=NEXT_PUBLIC_SITE_DOMAIN&envDescription=Your%20domain) [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2FTheDavidDelta%2Flingva-translate%2Ftree%2Fmain&env=NEXT_PUBLIC_SITE_DOMAIN&envDescription=Your%20domain)
There's also an [official Docker image](https://hub.docker.com/repository/docker/thedaviddelta/lingva-translate) available for easing the deployment using Compose, Kubernetes or similar technologies. Remember to also include the environment variable (simplified to `site_domain`) when running the container.
```bash
docker run -p 3000:3000 -e site_domain=lingva.ml thedaviddelta/lingva-translate:latest
```
## Instances ## Instances
@@ -48,7 +54,6 @@ These are the currently known *Lingva* instances. Feel free to make a Pull Reque
| [translate.tixte.gifts](https://translate.tixte.gifts) | [Vercel](https://vercel.com/) | [Let's Encrypt](https://www.ssllabs.com/ssltest/analyze.html?d=translate.tixte.gifts) | | [translate.tixte.gifts](https://translate.tixte.gifts) | [Vercel](https://vercel.com/) | [Let's Encrypt](https://www.ssllabs.com/ssltest/analyze.html?d=translate.tixte.gifts) |
## Public APIs ## Public APIs
Nearly all the *Lingva* instances should supply a pair of public developer APIs: a RESTful one and a GraphQL one. Nearly all the *Lingva* instances should supply a pair of public developer APIs: a RESTful one and a GraphQL one.