forked from docker-archive/birthdaysite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·45 lines (37 loc) · 1.09 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -e
set -o pipefail
# Print a usage message and exit.
usage() {
cat >&2 <<'EOF'
To run, I need:
- to be in a container generated by the Dockerfile at the top of the Docker
repository;
- to be provided with the name of an S3 bucket, in environment variable
AWS_S3_BUCKET;
- to be provided with AWS credentials for this S3 bucket, in environment
variables AWS_ACCESS_KEY and AWS_SECRET_KEY;
- a generous amount of good will and nice manners.
The canonical way to run me is to run the image produced by the Dockerfile: e.g.:"
docker run -e AWS_S3_BUCKET=docker.party \
-e AWS_ACCESS_KEY=... \
-e AWS_SECRET_KEY=... \
-it \
docker:birthday ./release.sh
EOF
exit 1
}
echo "Building site with hugo"
hugo
if [[ ! -d public ]]; then
echo "something went wrong we should have a public folder."
fi
[ "$AWS_S3_BUCKET" ] || usage
[ "$AWS_ACCESS_KEY" ] || usage
[ "$AWS_SECRET_KEY" ] || usage
# move presentation to public
mv presentation.pdf public/
# enter public
cd public
# upload the files to s3
s3cmd sync -P . s3://$AWS_S3_BUCKET/