|
|
|
FROM node:20-alpine as build |
|
|
|
RUN mkdir /home/app |
|
|
|
WORKDIR /home/app |
|
|
|
COPY package.json . |
|
|
|
RUN npm install --ignore-scripts |
|
|
|
COPY . . |
|
|
|
RUN npm run build |
|
|
|
|
|
FROM node:20-alpine as prod |
|
|
|
LABEL org.opencontainers.image.source=https://github.com/ghoshRitesh12/aniwatch-api |
|
LABEL org.opencontainers.image.description="Node.js API for obtaining anime information from aniwatch.to (formerly zoro.to) written in TypeScript, made with Cheerio & Axios" |
|
LABEL org.opencontainers.image.description "Node.js API for obtaining anime information from aniwatch.to (formerly zoro.to) written in TypeScript, made with Cheerio & Axios" |
|
LABEL org.opencontainers.image.licenses=MIT |
|
|
|
|
|
RUN addgroup -S aniwatch && adduser -S zoro -G aniwatch |
|
|
|
|
|
RUN mkdir -p /app/public /app/dist && chown -R zoro:aniwatch /app |
|
|
|
|
|
USER zoro |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
COPY --chown=zoro:aniwatch package.json . |
|
|
|
|
|
RUN npm install --omit=dev --ignore-scripts |
|
|
|
|
|
COPY --from=build --chown=zoro:aniwatch /home/app/public /app/public |
|
|
|
|
|
COPY --from=build --chown=zoro:aniwatch /home/app/dist /app/dist |
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s CMD [ "npm", "run", "healthcheck" ] |
|
|
|
ENV NODE_ENV=production |
|
ENV PORT=7860 |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
CMD [ "node", "dist/src/server.js" ] |
|
|
|
|