generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1387c70
commit b20d485
Showing
1 changed file
with
20 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
FROM node:16.14.0-alpine | ||
|
||
# Set npm cache directory | ||
# Set cache directory within the user's home directory | ||
ENV NPM_CONFIG_CACHE=/home/node/.npm | ||
|
||
# Install packages, build, and keep only prod packages | ||
WORKDIR /app | ||
|
||
# A wildcard is used to ensure both package.json AND package-lock.json are copied | ||
# Copy package.json and package-lock.json | ||
COPY package*.json ./ | ||
|
||
# Install app dependencies using the `npm ci` command instead of `npm install` | ||
RUN npm config set unsafe-perm true \ | ||
&& npm ci \ | ||
&& npm config set unsafe-perm false | ||
# Set NODE_ENV environment variable | ||
RUN npm ci | ||
|
||
# Bundle app source | ||
COPY . . | ||
|
||
# Install postgresql-client | ||
# Set permissions for the application directory | ||
RUN chmod -R 755 /app | ||
|
||
# Ensure ownership of .npm folder | ||
RUN mkdir -p /home/node/.npm \ | ||
&& chown -R node:node /home/node/.npm | ||
|
||
# Install PostgreSQL client if needed | ||
# Install PostgreSQL client | ||
RUN apk add --no-cache postgresql-client | ||
|
||
# Define the entrypoint | ||
ENTRYPOINT [ "sh", "initDB.sh" ] | ||
# Disable npm cache | ||
RUN npm config set cache false | ||
|
||
# Set executable permissions for scripts | ||
RUN chmod +x initDB.sh | ||
|
||
ENTRYPOINT ["sh", "initDB.sh"] |