@@ -27,7 +27,7 @@ type: Load Balanced Web Service
27
27
28
28
image:
29
29
# Path to your service's Dockerfile.
30
- build: hello/Dockerfile
30
+ location: %s
31
31
# Port exposed through your container to route traffic to it.
32
32
port: 3000
33
33
depends_on:
@@ -52,9 +52,10 @@ count: 1
52
52
sidecars:
53
53
nginx:
54
54
port: 80
55
- image: %s # Image URL for sidecar container.
55
+ image:
56
+ build: nginx/Dockerfile
56
57
variables:
57
- NGINX_PORT: %s
58
+ NGINX_PORT: 80
58
59
env_file: ./magic.env
59
60
logging:
60
61
env_file: ./magic.env
@@ -65,9 +66,30 @@ logging:
65
66
log_stream_prefix: copilot/
66
67
`
67
68
68
- const nginxPort = "80"
69
+ var mainImageURI string
69
70
70
71
var _ = Describe ("sidecars flow" , func () {
72
+ Context ("build and push main image to ECR repo" , func () {
73
+ var uri string
74
+ var err error
75
+ It ("create new ECR repo for main container" , func () {
76
+ uri , err = aws .CreateECRRepo (mainRepoName )
77
+ Expect (err ).NotTo (HaveOccurred (), "create ECR repo for main container" )
78
+ mainImageURI = fmt .Sprintf ("%s:mytag" , uri )
79
+ })
80
+ It ("push main container image" , func () {
81
+ var password string
82
+ password , err = aws .ECRLoginPassword ()
83
+ Expect (err ).NotTo (HaveOccurred (), "get ecr login password" )
84
+ err = docker .Login (uri , password )
85
+ Expect (err ).NotTo (HaveOccurred (), "docker login" )
86
+ err = docker .Build (mainImageURI , "./hello" )
87
+ Expect (err ).NotTo (HaveOccurred (), "build main container image" )
88
+ err = docker .Push (mainImageURI )
89
+ Expect (err ).NotTo (HaveOccurred (), "push to ECR repo" )
90
+ })
91
+ })
92
+
71
93
Context ("when creating a new app" , Ordered , func () {
72
94
var (
73
95
initErr error
@@ -167,33 +189,11 @@ var _ = Describe("sidecars flow", func() {
167
189
})
168
190
})
169
191
170
- Context ("build and push sidecar image to ECR repo" , func () {
171
- var uri string
172
- var err error
173
- tag := "vortexstreet"
174
- It ("create new ECR repo for sidecar" , func () {
175
- uri , err = aws .CreateECRRepo (sidecarRepoName )
176
- Expect (err ).NotTo (HaveOccurred (), "create ECR repo for sidecar" )
177
- sidecarImageURI = fmt .Sprintf ("%s:%s" , uri , tag )
178
- })
179
- It ("push sidecar image" , func () {
180
- var password string
181
- password , err = aws .ECRLoginPassword ()
182
- Expect (err ).NotTo (HaveOccurred (), "get ecr login password" )
183
- err = docker .Login (uri , password )
184
- Expect (err ).NotTo (HaveOccurred (), "docker login" )
185
- err = docker .Build (sidecarImageURI , "./nginx" )
186
- Expect (err ).NotTo (HaveOccurred (), "build sidecar image" )
187
- err = docker .Push (sidecarImageURI )
188
- Expect (err ).NotTo (HaveOccurred (), "push to ECR repo" )
189
- })
190
- })
191
-
192
192
Context ("write local manifest and addon files" , func () {
193
193
var newManifest string
194
194
It ("overwrite existing manifest" , func () {
195
195
logGroupName := fmt .Sprintf ("%s-test-%s" , appName , svcName )
196
- newManifest = fmt .Sprintf (manifest , sidecarImageURI , nginxPort , logGroupName )
196
+ newManifest = fmt .Sprintf (manifest , mainImageURI , logGroupName )
197
197
err := os .WriteFile ("./copilot/hello/manifest.yml" , []byte (newManifest ), 0644 )
198
198
Expect (err ).NotTo (HaveOccurred (), "overwrite manifest" )
199
199
})
0 commit comments