File tree Expand file tree Collapse file tree 1 file changed +22
-13
lines changed
Expand file tree Collapse file tree 1 file changed +22
-13
lines changed Original file line number Diff line number Diff line change @@ -109,19 +109,7 @@ export async function startNextcloud(branch = 'master', mountApp: boolean|string
109109 }
110110
111111 try {
112- // Pulling images
113- console . log ( '\nPulling images… ⏳' )
114- await new Promise ( ( resolve , reject ) => docker . pull ( SERVER_IMAGE , ( _err , stream : Stream ) => {
115- const onFinished = function ( err : Error | null ) {
116- if ( ! err ) {
117- return resolve ( true )
118- }
119- reject ( err )
120- }
121- // https://github.com/apocas/dockerode/issues/357
122- docker . modem . followProgress ( stream , onFinished )
123- } ) )
124- console . log ( '└─ Done' )
112+ await pullImage ( )
125113
126114 // Getting latest image
127115 console . log ( '\nChecking running containers… 🔍' )
@@ -207,6 +195,27 @@ export async function startNextcloud(branch = 'master', mountApp: boolean|string
207195 }
208196}
209197
198+ const pullImage = function ( ) {
199+ // Pulling images
200+ console . log ( '\nPulling images… ⏳' )
201+ return new Promise ( ( resolve , reject ) => docker . pull ( SERVER_IMAGE , ( _err , stream : Stream ) => {
202+ const onFinished = function ( err : Error | null ) {
203+ if ( ! err ) {
204+ return resolve ( true )
205+ }
206+ reject ( err )
207+ }
208+ // https://github.com/apocas/dockerode/issues/357
209+ if ( stream ) {
210+ docker . modem . followProgress ( stream , onFinished )
211+ } else {
212+ reject ( 'Failed to open stream' )
213+ }
214+ } ) )
215+ . then ( ( ) => console . log ( '└─ Done' ) )
216+ . catch ( err => console . log ( `└─ 🛑 FAILED! Trying to continue with existing image. (${ err } )` ) )
217+ }
218+
210219/**
211220 * Configure Nextcloud
212221 *
You can’t perform that action at this time.
0 commit comments