-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9448835
commit ac7a4aa
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM node:16-alpine | ||
ENV AWS_CLI_VERSION 1.15.47 | ||
WORKDIR /app | ||
|
||
#copy all the app files | ||
COPY . . | ||
|
||
RUN apk --no-cache update | ||
|
||
RUN apk add --no-cache build-base rsync git | ||
|
||
#install packages for aws-env | ||
RUN apk add --no-cache python3 py-pip py-setuptools groff less openssl ca-certificates bash && \ | ||
pip --no-cache-dir install awscli==${AWS_CLI_VERSION} && \ | ||
rm -rf /var/cache/apk/* | ||
|
||
#Download aws-env | ||
RUN wget https://github.com/Droplr/aws-env/raw/master/bin/aws-env-linux-amd64 -O /bin/aws-env && chmod +x /bin/aws-env | ||
|
||
#Install dependencies and build | ||
RUN yarn install && yarn build && yarn add serve | ||
|
||
CMD eval $(aws-env) && yarn serve build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
version: 0.2 | ||
|
||
env: | ||
git-credential-helper: yes | ||
parameter-store: | ||
DOCKER_HUB_USER: '/devops/shared/DOCKER_HUB_USER' | ||
DOCKER_HUB_PASSWORD: '/devops/shared/DOCKER_HUB_PASSWORD' | ||
|
||
phases: | ||
install: | ||
runtime-versions: | ||
nodejs: 14 | ||
commands: | ||
- n 16 | ||
- npm update -g npm | ||
- aws --version | ||
- node -v | ||
pre_build: | ||
commands: | ||
- export APP_BUILD_VERSION=${CODEBUILD_RESOLVED_SOURCE_VERSION}__$(date -u '+%Y-%m-%dT%T+00:00') | ||
- echo $APP_BUILD_VERSION > ./src/.version | ||
- cat ./src/.version | ||
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $DOCKER_REPOSITORY_URI | ||
- IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) | ||
build: | ||
commands: | ||
- echo $DOCKER_HUB_PASSWORD | docker login --username $DOCKER_HUB_USER --password-stdin | ||
- docker build -t $DOCKER_REPOSITORY_URI:latest . | ||
- docker tag $DOCKER_REPOSITORY_URI:latest $DOCKER_REPOSITORY_URI:$IMAGE_TAG | ||
post_build: | ||
commands: | ||
- docker push $DOCKER_REPOSITORY_URI:latest | ||
- docker push $DOCKER_REPOSITORY_URI:$IMAGE_TAG | ||
- printf '[{"name":"%s","imageUri":"%s"}]' $CONTAINER_NAME $DOCKER_REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json | ||
artifacts: | ||
files: | ||
- imagedefinitions.json |