-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moving docker files to root, now includes the client build as well
- Loading branch information
1 parent
007ad5b
commit b30d702
Showing
4 changed files
with
88 additions
and
24 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
**/node_modules/ | ||
node_modules | ||
**/vue.config.js | ||
vue.config.js | ||
Dockerfile | ||
.env.* | ||
.env | ||
README.md |
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 |
---|---|---|
|
@@ -45,27 +45,57 @@ RUN npm install -g [email protected] | |
|
||
FROM node AS tmp_builder | ||
|
||
# Use /app | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json to /app | ||
COPY package*.json ./ | ||
|
||
# Update npm | ||
RUN npm install -g [email protected] | ||
|
||
# Install vue cli service | ||
RUN npm install -g @vue/cli-service | ||
|
||
# Use /app/client | ||
WORKDIR /app/client | ||
|
||
# Copy client package.json and package-lock.json to /app/client | ||
COPY ./client/package*.json ./ | ||
|
||
# install node modules for client | ||
RUN npm install | ||
|
||
# Copy the rest of the code | ||
COPY ./client . | ||
|
||
# build client | ||
RUN npm run build | ||
|
||
# Use /app/server | ||
WORKDIR /app/server | ||
|
||
# Copy package.json and package-lock.json to /app/server | ||
COPY ./server/package*.json ./ | ||
|
||
# install node modules | ||
RUN npm install | ||
|
||
# Copy the rest of the code | ||
COPY . . | ||
COPY ./server . | ||
|
||
# Copy the docs help file to /app/server | ||
COPY ./docs/_data/help.yaml . | ||
|
||
# Invoke the build script to transpile code to js | ||
RUN npm run build | ||
|
||
# Remove persistent subfolder | ||
RUN rm -rf ./dist/persistent | ||
|
||
# Remove client subfolder | ||
RUN rm -rf ./dist/views | ||
|
||
# Create the views folder | ||
RUN mkdir -p ./dist/views | ||
|
||
# move client build to server | ||
RUN mv /app/client/dist/* ./dist/views | ||
|
||
################################################## | ||
# final build | ||
# take base and install production app dependencies | ||
|
@@ -80,10 +110,10 @@ COPY package*.json ./ | |
RUN npm i --only=production | ||
|
||
# Copy transpiled js from builder stage into the final image | ||
COPY --from=tmp_builder /app/dist ./dist | ||
COPY --from=tmp_builder /app/server/dist ./dist | ||
|
||
# Copy the ansible.cfg file to /etc/ansible/ directory | ||
COPY ansible.cfg /etc/ansible/ansible.cfg | ||
COPY ./server/ansible.cfg /etc/ansible/ansible.cfg | ||
|
||
# Use js files to run the application | ||
ENTRYPOINT ["node", "./dist/index.js"] |
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 |
---|---|---|
|
@@ -64,28 +64,59 @@ RUN ansible-galaxy collection install community.mysql -p /usr/share/ansible/coll | |
# why from diff image? for faster build, this image has node preinstalled and can start building immediately | ||
# if only the node app changes, the intermediate image can be cached and the final image will be faster to build | ||
|
||
FROM node:16-alpine AS tmp_builder | ||
FROM node AS tmp_builder | ||
|
||
# Use /app | ||
WORKDIR /app | ||
# Update npm | ||
RUN npm install -g [email protected] | ||
|
||
# Copy package.json and package-lock.json to /app | ||
COPY package*.json ./ | ||
# Install vue cli service | ||
RUN npm install -g @vue/cli-service | ||
|
||
# Install all dependencies | ||
RUN npm install -g | ||
# Use /app/client | ||
WORKDIR /app/client | ||
|
||
# Copy client package.json and package-lock.json to /app/client | ||
COPY ./client/package*.json ./ | ||
|
||
# install node modules for client | ||
RUN npm install | ||
|
||
# Copy the rest of the code | ||
COPY . . | ||
COPY ./client . | ||
|
||
# build client | ||
RUN npm run build | ||
|
||
# Use /app/server | ||
WORKDIR /app/server | ||
|
||
# Copy package.json and package-lock.json to /app/server | ||
COPY ./server/package*.json ./ | ||
|
||
# install node modules | ||
RUN npm install | ||
|
||
# Copy the rest of the code | ||
COPY ./server . | ||
|
||
# Copy the docs help file to /app/server | ||
COPY ./docs/_data/help.yaml . | ||
|
||
# Invoke the build script to transpile code to js | ||
RUN npm run build | ||
|
||
# Remove persistent subfolder | ||
RUN rm -rf ./dist/persistent | ||
|
||
# Remove client subfolder | ||
RUN rm -rf ./dist/views | ||
|
||
# Create the views folder | ||
RUN mkdir -p ./dist/views | ||
|
||
# move client build to server | ||
RUN mv /app/client/dist/* ./dist/views | ||
|
||
################################################## | ||
# final build | ||
# take base and install production app dependencies | ||
|
@@ -97,15 +128,15 @@ FROM debianbase as final | |
COPY package*.json ./ | ||
|
||
# Copy transpiled js from builder stage into the final image | ||
COPY --from=tmp_builder /app/dist ./dist | ||
COPY --from=tmp_builder /app/server/dist ./dist | ||
|
||
# Install only production dependencies | ||
# the build was done in alpine, so we need to remove any previous node_modules | ||
RUN rm -rf ./dist/node_modules | ||
RUN npm install --only=production | ||
|
||
# Copy the ansible.cfg file to /etc/ansible/ directory | ||
COPY ansible.cfg /etc/ansible/ansible.cfg | ||
COPY ./server/ansible.cfg /etc/ansible/ansible.cfg | ||
|
||
# Use js files to run the application | ||
ENTRYPOINT ["node", "./dist/index.js"] |
This file was deleted.
Oops, something went wrong.