I am trying to create a docker container for my application but there seems to be an error with my Docker script. Whenever I run the command docker build - < Dockerfile
, I get the following output:
I'm not entirely sure why this is happening, since my folder layout is the following:
root folder, Docker ---
server ---- package.json
api
tests
In case the folder layout was a bit confusing, I have my docker file inside my root folder and inside the root folder is the folder called server which contains my package.json, my api files and the tests.
Here's my docker script:
# --- Base Node ---
FROM alpine:3.8 AS base
#install node
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.7/main/ nodejs=8.9.3-r1 tini
# set working directory
WORKDIR /usr/src/app
# set tini as entrypoint
ENTRYPOINT ["/sbin/tini", "--"]
# copy project file
COPY . server/package*.json ./
# --- Dependencies ---
FROM base AS dependencies
# install node packages
RUN npm set progress=false && npm config set depth 0
RUN npm install .
# copy production node_modules aside
RUN cp -R node_modules prod_node_modules
# install ALL node_modules, including 'devDependencies'
RUN npm install
#
# ---- Test ----
# run linters, setup and tests
FROM dependencies AS test
COPY . .
RUN npm run lint && npm run test
#
# ---- Release ----
FROM base AS release
# copy production node_modules
COPY --from=dependencies /root/server/prod_node_modules ./node_modules
# copy app sources
COPY server/ ./
# expose port and define CMD
EXPOSE 3003
CMD [ "npm", "start" ]
I've used this question as an example.
Why am I getting this error from my docker script?