Skip to content

Commit

Permalink
fix: ✅ Copy package.json and package-lock.json in Dockerfile
Browse files Browse the repository at this point in the history
Now the dockerfile will copy the package.json and package-lock.json. Additionally npm clean-install instead of install will be called in the root folder. This downloads all dependencies without possibly modifying the lock file.
  • Loading branch information
Tomtec331 committed Feb 9, 2024
1 parent 775e572 commit c0cef0c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# Node modules
node_modules
frontend/node_modules
backend/node_modules

# Build folders
frontend/build
backend/dist
backend/static

# Workers
frontend/public/dist

npm-debug.log
.env.local
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ EXPOSE 3001/tcp
RUN useradd -m -s /bin/bash p4
WORKDIR /home/p4/learn-sdn-hub

# copy frontend and backend files to the image
# copy necessary files to image
COPY frontend frontend
COPY backend backend
COPY package.json .
COPY package-lock.json .

# build backend and frontend, create static backend
RUN cd backend && npm install && npm run compile
RUN cd frontend && npm install && npm run build && npm run create-static-backend
# build frontend and create static backend
RUN npm clean-install
RUN cd frontend && npm run build && npm run create-static-backend

# copy example startup script and use it as the entrypoint when running the container
COPY examples/start-learn-sdn-hub.sh start-learn-sdn-hub.sh
Expand Down

0 comments on commit c0cef0c

Please sign in to comment.