1
1
import { DeploymentConfiguration } from '../types'
2
- import { assertGraphiQL , assertQuery , waitForEndpoint } from '../utils'
2
+ import {
3
+ assertGraphiQL ,
4
+ assertQuery ,
5
+ execPromise ,
6
+ waitForEndpoint ,
7
+ } from '../utils'
3
8
import * as docker from '@pulumi/docker'
4
9
import { interpolate } from '@pulumi/pulumi'
5
- import { resolve } from 'path'
10
+ import { join , resolve } from 'path'
6
11
7
12
export const dockerDeployment = (
8
13
image : string ,
9
14
) : DeploymentConfiguration < {
10
15
endpoint : string
11
16
} > => ( {
17
+ prerequisites : async ( ) => {
18
+ await execPromise ( 'yarn build' , {
19
+ cwd : '../examples/node-ts' ,
20
+ } )
21
+ } ,
12
22
program : async ( ) => {
13
23
const remoteImage = new docker . RemoteImage ( 'node-image' , {
14
24
name : image ,
@@ -17,14 +27,14 @@ export const dockerDeployment = (
17
27
18
28
const container = new docker . Container ( 'container' , {
19
29
image : remoteImage . repoDigest ,
20
- command : [ `npx ` , '. ' ] ,
30
+ command : [ `node ` , 'index.js ' ] ,
21
31
volumes : [
22
32
{
23
33
containerPath : '/app' ,
24
- hostPath : resolve ( '../' ) ,
34
+ hostPath : resolve ( '../examples/node-ts/dist ' ) ,
25
35
} ,
26
36
] ,
27
- workingDir : '/app/packages/graphql-yoga/dist ' ,
37
+ workingDir : '/app' ,
28
38
ports : [
29
39
{
30
40
internal : 4000 ,
@@ -38,7 +48,7 @@ export const dockerDeployment = (
38
48
)
39
49
40
50
return {
41
- endpoint : interpolate `http://${ endpoint } ` ,
51
+ endpoint : interpolate `http://${ endpoint } /graphql ` ,
42
52
}
43
53
} ,
44
54
test : async ( { endpoint } ) => {
0 commit comments