Skip to content

Commit

Permalink
feat: service dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
njfamirm committed Nov 26, 2023
1 parent 37b8e3a commit 9499483
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions cloud/service.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM docker.io/library/node:20-alpine as builder

WORKDIR /app

COPY . .
RUN if [ -f *.lock ]; then \
yarn install --immutable; \
else \
yarn install; \
fi;

ENV NODE_ENV production

RUN yarn build:ts

# Build target package
ARG packageSource
RUN set -ex;\
if [ -z "$packageSource" ]; then\
echo 'packageSource not defined'>&2;\
exit 1;\
fi;
RUN set -ex;\
cd "$packageSource"; pwd; ls -lahF;\
yarn build;

# ---

FROM docker.io/library/node:20-alpine as service

WORKDIR /app

CMD ["yarn", "serve"]

ENV NODE_ENV production
ENV NODE_OPTIONS --enable-source-maps
ENV HOST 0.0.0.0
ENV PORT 80
EXPOSE 80

# Copy builded files from last stage
ARG packageSource
COPY ${packageSource}/package.json ./
COPY ${packageSource}/dist ./dist

# RUN pwd; ls -lAhF;

0 comments on commit 9499483

Please sign in to comment.