Skip to content

Commit

Permalink
fix: update dockerfile based on alwatr
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm authored and AliMD committed Dec 5, 2022
1 parent 1ca9d3f commit 30d7c0a
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 45 deletions.
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
PORT=80

# pwa
DOMAIN=flight-finder.ir
AUTH=

# storage
STORAGE_TOKEN='YOUR_SECRET_TOKEN'
STORAGE_NAME='job'
Expand All @@ -15,4 +19,4 @@ NOTIFIER_TO='all'
NOTIFIER_TOKEN='YOUR_SECRET_TOKEN'

# telegram-notifier
TELEGRAM_BOT_TOKEN=
TELEGRAM_BOT_TOKEN=
28 changes: 15 additions & 13 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG NODE_VERSION=lts
FROM docker.io/library/node:${NODE_VERSION} as build
ARG NODE_VERSION=19
FROM docker.io/library/node:${NODE_VERSION}-alpine as builder

WORKDIR /app

Expand All @@ -11,26 +11,28 @@ RUN if [ -f *.lock ]; then \
fi;

COPY . .
RUN yarn build

ARG DIST=dist
RUN ls -lahF ${DIST}
RUN yarn build && \
rm -rf node_modules && \
yarn install --frozen-lockfile --non-interactive --production && \
ls -lahF && \
ls -lAh dist

# ---

FROM docker.io/library/node:${NODE_VERSION}
FROM docker.io/library/node:${NODE_VERSION}-alpine as app

WORKDIR /app

RUN apk add --no-cache tini
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "index.js"]

ENV NODE_ENV production
ENV ALWATR_DEBUG *
ENV HOST 0.0.0.0
ENV PORT 80
EXPOSE 80
CMD ["node", "index.js"]

COPY --from=build /app/package.json /app/yarn.lock ./
RUN yarn install --frozen-lockfile --non-interactive --production && yarn cache clean

ARG DIST=dist
COPY --from=build /app/${DIST} .
COPY --from=builder /app/node_modules/ ./node_modules/
COPY --from=builder /app/dist/ ./
RUN ls -lahF
8 changes: 8 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,11 @@ services:
options:
max-size: '10m'
max-file: '2'

labels:
traefik.enable: true
traefik.port: 80
traefik.frontend.rule: Host:${DOMAIN}
traefik.frontend.entryPoints: http, https
traefik.frontend.redirect.entryPoint: https
traefik.frontend.auth.basic.users: $AUTH
28 changes: 15 additions & 13 deletions crawler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG NODE_VERSION=lts
FROM docker.io/library/node:${NODE_VERSION} as build
ARG NODE_VERSION=19
FROM docker.io/library/node:${NODE_VERSION}-alpine as builder

WORKDIR /app

Expand All @@ -11,26 +11,28 @@ RUN if [ -f *.lock ]; then \
fi;

COPY . .
RUN yarn build

ARG DIST=dist
RUN ls -lahF ${DIST}
RUN yarn build && \
rm -rf node_modules && \
yarn install --frozen-lockfile --non-interactive --production && \
ls -lahF && \
ls -lAh dist

# ---

FROM docker.io/library/node:${NODE_VERSION}
FROM docker.io/library/node:${NODE_VERSION}-alpine as app

WORKDIR /app

RUN apk add --no-cache tini
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "index.js"]

ENV NODE_ENV production
ENV ALWATR_DEBUG *
ENV HOST 0.0.0.0
ENV PORT 80
EXPOSE 80
CMD ["node", "index.js"]

COPY --from=build /app/package.json /app/yarn.lock ./
RUN yarn install --frozen-lockfile --non-interactive --production && yarn cache clean

ARG DIST=dist
COPY --from=build /app/${DIST} .
COPY --from=builder /app/node_modules/ ./node_modules/
COPY --from=builder /app/dist/ ./
RUN ls -lahF
10 changes: 5 additions & 5 deletions pwa/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG NODE_VERSION=lts
ARG NODE_VERSION=19
ARG NGINX_VERSION=1.0.0-1.23-alpine

FROM docker.io/library/node:${NODE_VERSION} as build
FROM docker.io/library/node:${NODE_VERSION}-alpine as builder

WORKDIR /app

Expand All @@ -13,10 +13,10 @@ RUN if [ -f *.lock ]; then \
fi;

COPY . .
RUN yarn build

FROM ghcr.io/alimd/nginx:${NGINX_VERSION}
RUN yarn build && \
ls -lAh dist

FROM ghcr.io/alimd/nginx:${NGINX_VERSION} as nginx

ARG DIST=dist
COPY --from=build /app/${DIST} .
Expand Down
28 changes: 15 additions & 13 deletions telegram-notifier/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG NODE_VERSION=lts
FROM docker.io/library/node:${NODE_VERSION} as build
ARG NODE_VERSION=19
FROM docker.io/library/node:${NODE_VERSION}-alpine as builder

WORKDIR /app

Expand All @@ -11,26 +11,28 @@ RUN if [ -f *.lock ]; then \
fi;

COPY . .
RUN yarn build

ARG DIST=dist
RUN ls -lahF ${DIST}
RUN yarn build && \
rm -rf node_modules && \
yarn install --frozen-lockfile --non-interactive --production && \
ls -lahF && \
ls -lAh dist

# ---

FROM docker.io/library/node:${NODE_VERSION}
FROM docker.io/library/node:${NODE_VERSION}-alpine as app

WORKDIR /app

RUN apk add --no-cache tini
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "index.js"]

ENV NODE_ENV production
ENV ALWATR_DEBUG *
ENV HOST 0.0.0.0
ENV PORT 80
EXPOSE 80
CMD ["node", "index.js"]

COPY --from=build /app/package.json /app/yarn.lock ./
RUN yarn install --frozen-lockfile --non-interactive --production && yarn cache clean

ARG DIST=dist
COPY --from=build /app/${DIST} .
COPY --from=builder /app/node_modules/ ./node_modules/
COPY --from=builder /app/dist/ ./
RUN ls -lahF

0 comments on commit 30d7c0a

Please sign in to comment.