Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dockerfile-testt #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# The Dockerfile is the description of all the commands to run to assemble the image.
# Read about all the commands here: https://docs.docker.com/engine/reference/builder/

# We also have a docker-compose.yml file, which is used to build and run this Docker image.


# Start from the official Node 6 alpine image. https://hub.docker.com/_/node/
FROM node:8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finding of type dockerfiles detected.
Healthcheck Instruction Missing
Ensure that HEALTHCHECK is being used. The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working


# Disable update check
ENV NO_UPDATE_NOTIFIER=true

# Set the working directory for following commands.
ENV HOME=/app
WORKDIR /app

# Add a user so that we don't run as root:
# https://github.com/telusdigital/reference-architecture/blob/3ff683dd68b247ac9a3febda828105fe52cd9390/delivery/docker.md#root-vs-user-mode
RUN set -ex && \
adduser node root && \
chmod g+w /app

# Copy only the files necessary to install dependencies into the working directory.
# Docker builds the image in layers and caches them. Because the app files change more often than the dependencies, we
# copy the app files only after we install the depencendies.
COPY .npmrc package.json package-lock.json lerna.json ./

# Install git, which is necessary for the install process.
RUN apt-get update && \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finding of type dockerfiles detected.
APT-GET Missing '-y' To Avoid Manual Input
Check if apt-get calls use the flag -y to avoid user manual input.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finding of type dockerfiles detected.
Apt Get Install Pin Version Not Defined
When installing a package, its pin version should be defined

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finding of type dockerfiles detected.
APT-GET Not Avoiding Additional Packages
Check if any apt-get installs don't use '--no-install-recommends' flag to avoid installing additional packages.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finding of type dockerfiles detected.
Apt Get Install Lists Were Not Deleted
After using apt-get install, it is needed to delete apt-get lists

apt-get install git

# Install dependencies.
# `npm run gitbook:install` will happen in the "prepare" hook, right after `npm ci`
RUN set -ex && \
npm ci

# Copy all source and test files into the working directory.
# We use a .dockerignore file to prevent unnecessary or large files from being inadvertently copied.
COPY . /app

# Build the app.
RUN npm run gitbook:install && \
npx lerna bootstrap --hoist && \
npm run build -- --all && \
./scripts/ci-build-docs.sh \
rm .npmrc

# Set the container's user to the newly created one.
USER node

# The entrypoint configures the container to be run as an executable.
# Arguments supplied on the command line will be forwarded onto the entrypoint.
ENTRYPOINT ["npm", "run"]