Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure AWS codebuild and add docker support #2

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:18-alpine as app

WORKDIR /app
COPY . .

WORKDIR /app/front
RUN npm install
RUN npm run build

WORKDIR /app/server
RUN npm install
RUN npm run build

CMD ["npm", "run", "start:prod"]
24 changes: 24 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 0.2

phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 255840220362.dkr.ecr.eu-west-3.amazonaws.com
build:
commands:
- echo Build started on `date`
- docker build -t twenty-pilot .
- docker tag twenty-pilot 255840220362.dkr.ecr.eu-west-3.amazonaws.com/twenty-pilot:latest
- cd $CODEBUILD_SRC_DIR
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push 255840220362.dkr.ecr.eu-west-3.amazonaws.com/twenty-pilot:latest
- echo Writing image definitions file...
- printf '{"AWSEBDockerrunVersion":"1","Image":{"Name":"%s","Update":"true"},"Ports":[{"ContainerPort":3000,"HostPort":80}]}' 255840220362.dkr.ecr.eu-west-3.amazonaws.com/twenty-pilot:latest > Dockerrun.aws.json
- cat Dockerrun.aws.json

artifacts:
files: Dockerrun.aws.json