@@ -7,6 +7,7 @@ import puppetter from 'puppeteer';
77import { useMutation } from '@apollo/client/react/hooks/useMutation' ;
88import { toast } from 'sonner' ;
99import { UPDATE_PROJECT_PHOTO_URL } from '@/graphql/request' ;
10+ import { TLS } from '@/utils/const' ;
1011
1112const runningContainers = new Map <
1213 string ,
@@ -147,14 +148,26 @@ async function buildAndRunDocker(
147148 console . log ( `Running Docker container: ${ containerName } ` ) ;
148149
149150 // 3. Run the Docker container
150- const runCommand = `docker run -d --name ${ containerName } -l "traefik.enable=true" \
151+ let runCommand ;
152+ if ( TLS ) {
153+ runCommand = `docker run -d --name ${ containerName } -l "traefik.enable=true" \
151154 -l "traefik.http.routers.${ subdomain } .rule=Host(\\"${ domain } \\")" \
152155 -l "traefik.http.routers.${ subdomain } .entrypoints=websecure" \
153156 -l "traefik.http.routers.${ subdomain } .tls=true" \
154157 -l "traefik.http.services.${ subdomain } .loadbalancer.server.port=5173" \
155158 --network=codefox_traefik_network -p ${ exposedPort } :5173 \
156159 -v "${ directory } :/app" \
157160 ${ imageName } ` ;
161+ } else {
162+ runCommand = `docker run -d --name ${ containerName } -l "traefik.enable=true" \
163+ -l "traefik.http.routers.${ subdomain } .rule=Host(\\"${ domain } \\")" \
164+ -l "traefik.http.routers.${ subdomain } .entrypoints=web" \
165+ -l "traefik.http.services.${ subdomain } .loadbalancer.server.port=5173" \
166+ --network=codefox_traefik_network -p ${ exposedPort } :5173 \
167+ -v "${ directory } :/app" \
168+ ${ imageName } ` ;
169+ }
170+
158171 console . log ( `Executing run command: ${ runCommand } ` ) ;
159172
160173 exec ( runCommand , ( runErr , runStdout , runStderr ) => {
0 commit comments