2024-06-10 16:00:07 +00:00
|
|
|
#
|
|
|
|
# OneUptime-copilot Dockerfile
|
|
|
|
#
|
|
|
|
|
|
|
|
# Pull base image nodejs image.
|
2024-10-16 14:54:57 +00:00
|
|
|
FROM public.ecr.aws/docker/library/node:22.3.0
|
2024-06-10 16:00:07 +00:00
|
|
|
RUN mkdir /tmp/npm && chmod 2777 /tmp/npm && chown 1000:1000 /tmp/npm && npm config set cache /tmp/npm --global
|
|
|
|
|
2024-09-05 13:30:30 +00:00
|
|
|
RUN npm config set fetch-retries 5
|
|
|
|
RUN npm config set fetch-retry-mintimeout 100000
|
|
|
|
RUN npm config set fetch-retry-maxtimeout 600000
|
|
|
|
|
|
|
|
|
2024-06-10 16:00:07 +00:00
|
|
|
ARG GIT_SHA
|
|
|
|
ARG APP_VERSION
|
|
|
|
|
|
|
|
ENV GIT_SHA=${GIT_SHA}
|
|
|
|
ENV APP_VERSION=${APP_VERSION}
|
|
|
|
|
|
|
|
|
|
|
|
# IF APP_VERSION is not set, set it to 1.0.0
|
|
|
|
RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=1.0.0; fi
|
|
|
|
|
|
|
|
|
|
|
|
# Install bash.
|
2024-07-08 13:05:09 +00:00
|
|
|
RUN apt-get install bash -y && apt-get install curl -y
|
2024-06-10 16:00:07 +00:00
|
|
|
|
|
|
|
# Install python
|
2024-07-08 13:05:09 +00:00
|
|
|
RUN apt-get update && apt-get install -y .gyp python3 make g++
|
2024-06-10 16:00:07 +00:00
|
|
|
|
|
|
|
#Use bash shell by default
|
|
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
|
|
|
|
|
2024-07-08 13:05:09 +00:00
|
|
|
RUN mkdir -p /usr/src
|
2024-06-10 16:00:07 +00:00
|
|
|
|
|
|
|
WORKDIR /usr/src/Common
|
|
|
|
COPY ./Common/package*.json /usr/src/Common/
|
|
|
|
# Set version in ./Common/package.json to the APP_VERSION
|
|
|
|
RUN sed -i "s/\"version\": \".*\"/\"version\": \"$APP_VERSION\"/g" /usr/src/Common/package.json
|
|
|
|
RUN npm install
|
|
|
|
COPY ./Common /usr/src/Common
|
|
|
|
|
|
|
|
|
2024-08-05 16:06:53 +00:00
|
|
|
|
2024-06-10 16:00:07 +00:00
|
|
|
|
2024-07-25 01:04:25 +00:00
|
|
|
|
2024-06-10 16:00:07 +00:00
|
|
|
|
2024-08-07 21:50:32 +00:00
|
|
|
|
2024-06-10 16:00:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ENV PRODUCTION=true
|
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
# Install app dependencies
|
|
|
|
COPY ./Copilot/package*.json /usr/src/app/
|
|
|
|
RUN npm install
|
|
|
|
|
|
|
|
|
2024-06-28 13:55:58 +00:00
|
|
|
# Create /repository/ directory where the app will store the repository
|
2024-07-08 14:40:16 +00:00
|
|
|
RUN mkdir -p /repository
|
2024-06-28 13:55:58 +00:00
|
|
|
|
2024-07-02 11:29:31 +00:00
|
|
|
# Set the stack trace limit to 0 to show full stack traces
|
2024-07-05 12:00:16 +00:00
|
|
|
ENV NODE_OPTIONS='--stack-trace-limit=30'
|
2024-07-02 11:29:31 +00:00
|
|
|
|
2024-06-10 16:00:07 +00:00
|
|
|
{{ if eq .Env.ENVIRONMENT "development" }}
|
|
|
|
#Run the app
|
|
|
|
CMD [ "npm", "run", "dev" ]
|
|
|
|
{{ else }}
|
|
|
|
# Copy app source
|
2024-06-10 16:59:22 +00:00
|
|
|
COPY ./Copilot /usr/src/app
|
2024-06-10 16:00:07 +00:00
|
|
|
# Bundle app source
|
|
|
|
RUN npm run compile
|
|
|
|
#Run the app
|
|
|
|
CMD [ "npm", "start" ]
|
2024-07-10 17:19:09 +00:00
|
|
|
{{ end }}
|