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

deps apt-get install should be after apt-get update #125

Open
wants to merge 4 commits 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
18 changes: 7 additions & 11 deletions src/api/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ export const getDependencyInstallScripts = (deps = getDeps('deps')) => {
return '';
}
const delimiter = deps.includes(',') ? ',' : ' ';
return deps
.split(delimiter)
.reduce(
(accumulator, currentValue) => `${accumulator}RUN apt-get install ${currentValue}\n`,
'',
);
return `RUN apt-get install -y ${deps.split(delimiter).join(' ')}\n`;
};

// construct the Dockerfile contents
Expand All @@ -48,15 +43,16 @@ export const getDockerfileContents = async () => {
// check to see if mogno should be included
const includeMongo = shouldIncludeMongo();
return `FROM ${dockerImage}
${deps ? getDependencyInstallScripts(deps) : ''}
${includeMongo ? `RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
RUN echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.6 main" | tee /etc/apt/sources.list.d/mongodb-org-3.6.list` :''}
${includeMongo || deps ? 'RUN apt-get update' : ''}
${includeMongo
? `RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
RUN echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.6 main" | tee /etc/apt/sources.list.d/mongodb-org-3.6.list
RUN apt-get update
RUN apt-get install -y mongodb-org
? `RUN apt-get install -y mongodb-org
RUN apt-get install -y supervisor
VOLUME ["/data/db"]`
: ''}
${deps ? getDependencyInstallScripts(deps) : ''}
${includeMongo || deps ? 'RUN rm -rf /var/lib/apt/lists/*' : ''}
LABEL name="${projectName}"
COPY bundle/programs/server/package.json /usr/src/app/bundle/programs/server/package.json
WORKDIR /usr/src/app/bundle/programs/server
Expand Down