Skip to content

Instantly share code, notes, and snippets.

@iatsiuk
Last active May 30, 2022 13:33
Show Gist options
  • Save iatsiuk/1e173bfe8f027a30dd918ee8efe96e17 to your computer and use it in GitHub Desktop.
Save iatsiuk/1e173bfe8f027a30dd918ee8efe96e17 to your computer and use it in GitHub Desktop.
EditorConfig Configuration File
*
!src
!package*.json
!tsconfig*.json
!docker-entrypoint.sh
# EditorConfig Configuration File
# See http://editorconfig.org/#file-format-details for more details
root = true
[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 2
indent_style = space
#!/usr/bin/env bash
npm run start:prod
#--- base stage ----------------------------------------------------------------
FROM node:16-alpine AS base
RUN apk add --no-cache tzdata bash
ENV APP_PATH="/home/node/application"
WORKDIR $APP_PATH
#--- build application stage ---------------------------------------------------
FROM base AS build-application
ARG NPM_TOKEN
RUN [ ! -z "${NPM_TOKEN}" ] || { echo "Build-time variable NPM_TOKEN is not set"; exit 1; }
RUN apk add --no-cache \
python3 \
make \
g++
COPY . ./
RUN set -xe \
&& echo -e "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc \
&& npm i \
&& npm run build
#--- release stage -------------------------------------------------------------
FROM base AS release
COPY --chown=node:node --from=build-application $APP_PATH/node_modules ./node_modules
COPY --chown=node:node --from=build-application $APP_PATH/dist ./dist
COPY --chown=node:node package.json ./
COPY --chown=node:node docker-entrypoint.sh ./
USER node
ENV PATH="$PATH:$APP_PATH/node_modules/.bin"
ENTRYPOINT "$APP_PATH/docker-entrypoint.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment