Understanding ECS+ Fargate Source Code Mounting

Asked 1 years ago, Updated 1 years ago, 375 views

本We have multi-posted at 3 locations including this site.
https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q12274662377
https://teratail.com/questions/uuw328n9imd4ci
About mounting source code for ECS+Fargate

I am an ECS beginner.
The goal is to run the LAMP environment currently running on EC2 with ECS+Fargate.

Write the COPY command in the Dockerfile in the configuration below and
When building, I put the source code in a container and then push it to ECS.

COPY./html/var/www/html

docker build-tecs-demo-web./docker/web/

Project
d docker ┃ wweb
┃ br ┠ Dockerfile
┃t html
┃┃ inindex.php
┃ d db
┃ D Dockerfile
d docker-compose.yml

I think it is common to separate the Dockerfile and source code hierarchy as shown below.
(Current applications are also configured below)

Project
d docker ┃ wweb
┃ br ┗ Dockerfile
┃ d db
┃ D Dockerfile
h html ┃ in index.php
d docker-compose.yml

I don't think the COPY command can reference the parent directory, but
Is there a way to load the source code into the Fargate container without using the COPY command?

I would appreciate it if you could reply.Thank you for your cooperation.

aws docker aws-ecr

2023-01-28 19:38

1 Answers

It was solved by receiving a reply from my side by side.
https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q12274662377

■Use docker build for the former
docker build-t web./docker/web

■ In the latter case, use docker compose build
docker comfort build

build:
  context:.
  dockerfile


2023-01-28 21:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.