How to deploy to AWS using S3 and CloudFront in the official documentation? I would like to summarize how to easily deploy
with docker-compose.
(Official documentation) How to deploy to AWS using S3 and CloudFront?
Please refer to here for AWS (S3, CloudFront) settings.
nuxtapp/docker-compose.yml
nuxtapp/Dockerfile
nuxtapp/deploy.sh
nuxtapp/gulpfile.js
deploy.sh
and gulpfile.js
according to the official procedure.Dockerfile
FROM node:12.18.3-alpine3.9
RUN apk add --no-cache openssh bash python make
RUN npm install -g gulp
RUN npm install --save-dev gulp gulp-awspublish gulp-cloudfront-invalidate-aws-publish concurrent-transform
docker-compose.yml
version: '3'
services:
node: &app_base
build: .
# tty: true
working_dir: /var/www
volumes:
- .:/var/www
environment:
PORT: 3000
HOST: 0.0.0.0
install:
<<: *app_base
command: npm ci
dev:
<<: *app_base
ports:
- "3000:3000"
command: npm run dev
generate:
<<: *app_base
command: npm run generate
dev_static:
image: httpd
volumes:
- ./dist:/usr/local/apache2/htdocs/
ports:
- "80:80"
s3deploy:
<<: *app_base
command: ./deploy.sh
For docker-compose.yml
, change the article here from yarn to npm, and use the Dockerfile to manually install the procedure in the container. I prepared it.
Each container should be defined in docker-compose.yml
as needed.
$ docker-compose up dev
Run npm run dev
inside the container.
$ docker-compose up generate
Run npm run generate
inside the container.
The output result is output to nuxtapp / dist by default.
$ docker-compose up dev_static
Expose the dist locally in the tomcat container. http://localhostにアクセスするとアプリを確認できます。
$ docker-compose up s3deploy
Run deploy.sh
inside the container.
If you follow the success image of the official procedure, you are done.
Recommended Posts