0

In my recent project I've come to use Git Submodules, however I'm struggling to get my Docker container to download the information from the submodule on deployment.

Here's my Dockerfile (disclaimer: I am using CapRover, so their Dockerfile is formatted different, but everything is the same):

        "FROM library/node:16.6.0-alpine",
        "RUN apk update && apk upgrade &&     apk add --no-cache git", 
        "RUN mkdir -p /usr/src/app",
        "WORKDIR /usr/src/app",
        "COPY ./package.json /usr/src/app/",
        "RUN npm install --production && npm cache clean --force",
        "WORKDIR ./Status-Plus-Translation/",
        "RUN git submodule update --recursive --remote",
        "WORKDIR /usr/src/app",
        "COPY ./ /usr/src/app",
        "ENV NODE_ENV production",
        "ENV PORT 80",
        "EXPOSE 80",
        "CMD [ \"npm\", \"start\" ]"

For clarification, this is what my project's files look like:

enter image description here

When I run the top Dockerfile code, I get the following error:

enter image description here

FxllenCode
  • 63
  • 1
  • 1
  • 14
  • 4
    Seems pretty straightforward: your Docker setup does not create an initial Git repository (`git clone ...`) so there's no Git repository there yet in which to run `git submodule update`. – torek Jan 18 '22 at 22:16
  • Whoops, that might have been a helpful step... thanks! – FxllenCode Jan 19 '22 at 13:41

0 Answers0