Arno Kaimbacher
cf859ba402
All checks were successful
CI Pipeline / japa-tests (push) Successful in 54s
- add package @opensearch-project/opensearch for manipulating opensearch index - index tethys datasets via new command IndexDatasets, callable node ace index:datasets or node ace index:datasets -p 193 - add mapping file for opensearch index in public/records.json - added solr.xslt for transforming Datset model to json for opensearch adding in opensearch - added route /editor/ dataset/:id/update (beginning of editor/DatasetController.ts - npm updates
91 lines
3.0 KiB
Docker
91 lines
3.0 KiB
Docker
################## First Stage - Creating base #########################
|
|
|
|
# Created a variable to hold our node base image
|
|
ARG NODE_IMAGE=node:18-bookworm-slim
|
|
|
|
FROM $NODE_IMAGE AS base
|
|
# Install dumb-init and ClamAV, and perform ClamAV database update
|
|
RUN apt update \
|
|
&& apt-get install -y dumb-init clamav clamav-daemon nano \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
# Creating folders and changing ownerships
|
|
&& mkdir -p /home/node/app && chown node:node /home/node/app \
|
|
&& mkdir -p /var/lib/clamav \
|
|
&& mkdir /usr/local/share/clamav \
|
|
&& chown -R node:clamav /var/lib/clamav /usr/local/share/clamav /etc/clamav \
|
|
# permissions
|
|
&& mkdir /var/run/clamav \
|
|
&& chown node:clamav /var/run/clamav \
|
|
&& chmod 750 /var/run/clamav
|
|
# -----------------------------------------------
|
|
# --- ClamAV & FeshClam -------------------------
|
|
# -----------------------------------------------
|
|
# RUN \
|
|
# chmod 644 /etc/clamav/freshclam.conf && \
|
|
# freshclam && \
|
|
# mkdir /var/run/clamav && \
|
|
# chown -R clamav:root /var/run/clamav
|
|
|
|
# # initial update of av databases
|
|
# RUN freshclam
|
|
|
|
# Configure Clam AV...
|
|
COPY --chown=node:clamav ./*.conf /etc/clamav/
|
|
|
|
# # permissions
|
|
# RUN mkdir /var/run/clamav && \
|
|
# chown node:clamav /var/run/clamav && \
|
|
# chmod 750 /var/run/clamav
|
|
# Setting the working directory
|
|
WORKDIR /home/node/app
|
|
# Changing the current active user to "node"
|
|
USER node
|
|
|
|
# initial update of av databases
|
|
RUN freshclam
|
|
|
|
# VOLUME /var/lib/clamav
|
|
COPY --chown=node:clamav docker-entrypoint.sh /home/node/app/docker-entrypoint.sh
|
|
RUN chmod +x /home/node/app/docker-entrypoint.sh
|
|
ENV TZ="Europe/Vienna"
|
|
|
|
|
|
|
|
|
|
################## Second Stage - Installing dependencies ##########
|
|
# In this stage, we will start installing dependencies
|
|
FROM base AS dependencies
|
|
# We copy all package.* files to the working directory
|
|
COPY --chown=node:node ./package*.json ./
|
|
# We run NPM CI to install the exact versions of dependencies
|
|
RUN npm ci
|
|
# Lastly, we copy all the files with active user
|
|
COPY --chown=node:node . .
|
|
|
|
|
|
################## Third Stage - Building Stage #####################
|
|
# In this stage, we will start building dependencies
|
|
FROM dependencies AS build
|
|
# We run "node ace build" to build the app (dist folder) for production
|
|
RUN node ace build --production
|
|
|
|
|
|
################## Final Stage - Production #########################
|
|
# In this final stage, we will start running the application
|
|
FROM base AS production
|
|
# Here, we include all the required environment variables
|
|
# ENV NODE_ENV=production
|
|
# ENV PORT=$PORT
|
|
# ENV HOST=0.0.0.0
|
|
|
|
# Copy package.* to the working directory with active user
|
|
COPY --chown=node:node ./package*.json ./
|
|
# We run NPM CI to install the exact versions of production dependencies
|
|
RUN npm ci --omit=dev
|
|
# Copy files to the working directory from the build folder the user
|
|
COPY --chown=node:node --from=build /home/node/app/build .
|
|
# Expose port
|
|
EXPOSE 3333
|
|
ENTRYPOINT ["/home/node/app/docker-entrypoint.sh"]
|
|
# Run the command to start the server using "dumb-init"
|
|
CMD [ "dumb-init", "node", "server.js" ] |