thedaviddelta / lingva-translate

Alternative front-end for Google Translate

Home Page:https://lingva.thedaviddelta.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding Healthcheck

MatthK opened this issue · comments

Hi

I've been using Lingva for some time now and just thought to update it to the latest version. I have also added a healthcheck to the Dockerfile, so the docker container shows up as healthy.

I simply added the RUN apk add --no-cache curl before the USER nextis line, and then HEALTHCHECK --interval=1m --timeout=3s CMD curl -f http://localhost:3000/ || exit 1 before the CMD...

# https://nextjs.org/docs/deployment#docker-image

FROM node:lts-alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

FROM node:lts-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 .
RUN apk add --no-cache curl

USER nextjs

EXPOSE 3000

ENV NODE_ENV production

ENV NEXT_TELEMETRY_DISABLED 1

HEALTHCHECK --interval=1m --timeout=3s CMD curl -f http://localhost:3000/ || exit 1

CMD NEXT_PUBLIC_SITE_DOMAIN=$site_domain\
    NEXT_PUBLIC_FORCE_DEFAULT_THEME=$force_default_theme \
    NEXT_PUBLIC_DEFAULT_SOURCE_LANG=$default_source_lang \
    NEXT_PUBLIC_DEFAULT_TARGET_LANG=$default_target_lang \
    yarn build && yarn start

Anyway, thanks for this great project.

commented

Hello and sorry for the delay.

I've been taking a look and this is very cool! Just added it in the last PR. Thanks!