Files
oneuptime/Backend/Dockerfile
Nawaz Dhandala babf72e7b9 Rename services
2022-04-11 14:11:16 +01:00

61 lines
1.2 KiB
Docker
Executable File

#
# OneUptime-backend Dockerfile
#
# Pull base image nodejs image.
FROM node:alpine
# Install bash.
RUN apk update && apk add bash && apk add curl
# Install python
RUN apk update && apk add --no-cache --virtual .gyp python3 make g++
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
RUN mkdir /usr/src
# Install common
RUN mkdir /usr/src/common
WORKDIR /usr/src/common
COPY ./common/package*.json /usr/src/common/
RUN npm install
COPY ./common /usr/src/common
RUN npm compile
# Install CommonServer
RUN mkdir /usr/src/CommonServer
WORKDIR /usr/src/CommonServer
COPY ./CommonServer/package*.json /usr/src/CommonServer/
RUN npm install
COPY ./CommonServer /usr/src/CommonServer
RUN npm compile
#SET ENV Variables
ENV PRODUCTION=true
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# Install trivy for container scanning
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s -- -b /usr/local/bin
# Install app dependencies
COPY ./backend/package*.json /usr/src/app/
RUN npm install
RUN npm install -g ts-node
# Bundle app source
COPY ./backend /usr/src/app
# Expose ports.
# - 3002: OneUptime-backend
EXPOSE 3002
#Run the app
RUN npm compile
CMD [ "npm", "start"]