Skip to content

Instantly share code, notes, and snippets.

@chinhnguyen
Created January 7, 2020 09:22
Show Gist options
  • Save chinhnguyen/931547134681f1253cd7ac8b4ba89593 to your computer and use it in GitHub Desktop.
Save chinhnguyen/931547134681f1253cd7ac8b4ba89593 to your computer and use it in GitHub Desktop.
gitlab deployment frontend to AWS S3 and CloudFront
image: ntr9h/node-awscli2:latest
deploy:
stage: deploy
when: manual
script:
- npm run upload
- npm run upload:post
FROM node:12.13.1
LABEL maintainer="chinh@willbe.vn"
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
{
"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