Created
January 7, 2020 09:22
-
-
Save chinhnguyen/931547134681f1253cd7ac8b4ba89593 to your computer and use it in GitHub Desktop.
gitlab deployment frontend to AWS S3 and CloudFront
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
image: ntr9h/node-awscli2:latest | |
deploy: | |
stage: deploy | |
when: manual | |
script: | |
- npm run upload | |
- npm run upload:post |
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
FROM node:12.13.1 | |
LABEL maintainer="[email protected]" | |
LABEL nodeVersion="12.13.1" | |
LABEL awscliVersion="2.0.0" | |
LABEL version="1.0.0" | |
# https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux-mac.html | |
RUN curl "https://d1vvhvl2y92vvt.cloudfront.net/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
RUN unzip awscliv2.zip | |
RUN ./aws/install | |
RUN aws2 --version | |
RUN npm --version |
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
{ | |
"scripts": { | |
"upload": "aws2 s3 sync dist/ s3://yourpackage", | |
"upload:post": "aws2 cloudfront create-invalidation --distribution-id yourdistributionid --paths '/*'", | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment