Skip to content

Commit fab893e

Browse files
abiexpbot
authored andcommitted
circle-ci support
fbshipit-source-id: 48feb4b
1 parent 7b96dc9 commit fab893e

15 files changed

+168
-180
lines changed

Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM mhart/alpine-node:8.9.0
2+
3+
RUN apk --update add bash
4+
5+
ENV APP_PATH "/app"
6+
ENV NODE_ENV "production"
7+
8+
RUN mkdir -p /app /libraries
9+
ADD . /app
10+
11+
WORKDIR /app
12+
RUN yarn && \
13+
rm -rf "$(yarn cache dir)"
14+
15+
RUN yarn run build
16+
17+
EXPOSE 3000
18+
CMD ["./node_modules/.bin/cross-env", "NODE_ENV=production", "node", "server.js"]

Rockerfile

-32
This file was deleted.

build_image.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
3+
set -xeo pipefail
4+
5+
tag="$1"
6+
7+
echo tag
8+
9+
docs="$(pwd)"
10+
11+
if [[ "$docs" != "$EXPO_UNIVERSE_DIR/docs" ]]
12+
then
13+
echo 'not in docs directory'
14+
exit 1
15+
fi
16+
17+
owner="gcr.io/exponentjs"
18+
image="exponent-docs-v2"
19+
if [ ! -z "$tag" ]; then
20+
tagargs="-t $owner/$image:$tag -t $owner/$image:latest"
21+
fi
22+
23+
echo tagargs
24+
25+
# shellcheck disable=SC2086
26+
gcloud docker -- build $tagargs .
27+
28+
if [ ! -z "$tag" ]; then
29+
gcloud docker -- push "$owner/$image:$tag"
30+
gcloud docker -- push "$owner/$image:latest"
31+
fi

deploy.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
3+
set -xeo pipefail
4+
5+
environment=$1
6+
7+
if [ "$environment" == "production" ]; then
8+
export REPLICAS=2
9+
export INGRESS_HOSTNAME=next-docs.expo.io
10+
export ENVIRONMENT=production
11+
elif [ "$environment" == "staging" ]; then
12+
export REPLICAS=1
13+
export INGRESS_HOSTNAME=staging.next-docs.expo.io
14+
export ENVIRONMENT=staging
15+
else
16+
echo "Unrecognized environment $environment"
17+
exit 1
18+
fi
19+
20+
export TAG=$2
21+
22+
echo "Checking for image..."
23+
24+
if ! gcloud container images describe "gcr.io/exponentjs/exponent-docs-v2:$TAG"; then
25+
echo "Unable to find image tagged with $TAG"
26+
exit 2
27+
fi
28+
29+
echo "Environment set, found image, deploying..."
30+
31+
envsubst < ./docs.k8s.template.yml | kubectl apply -f -

deploy/charts/docs/.helmignore

-21
This file was deleted.

deploy/charts/docs/Chart.yaml

-4
This file was deleted.

deploy/charts/docs/templates/NOTES.txt

-1
This file was deleted.

deploy/charts/docs/templates/_helpers.tpl

-16
This file was deleted.

deploy/charts/docs/templates/docs.deployment.template.yml

-40
This file was deleted.

deploy/charts/docs/templates/docs.ingress.template.yml

-31
This file was deleted.

deploy/charts/docs/templates/docs.svc.template.yml

-16
This file was deleted.

deploy/charts/docs/values.yaml

-14
This file was deleted.

docs.k8s.template.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
apiVersion: extensions/v1beta1
3+
kind: Deployment
4+
metadata:
5+
name: docs
6+
namespace: ${ENVIRONMENT}
7+
labels:
8+
app: docs
9+
heritage: "Tiller"
10+
release: docs
11+
chart: "next-docs-1.0.0"
12+
spec:
13+
replicas: ${REPLICAS}
14+
minReadySeconds: 10
15+
revisionHistoryLimit: 10
16+
strategy:
17+
type: "RollingUpdate"
18+
rollingUpdate:
19+
maxUnavailable: 1
20+
maxSurge: 5
21+
template:
22+
metadata:
23+
labels:
24+
app: docs
25+
heritage: "Tiller"
26+
release: docs
27+
chart: "next-docs-1.0.0"
28+
spec:
29+
restartPolicy: Always
30+
containers:
31+
- name: next-docs
32+
image: "gcr.io/exponentjs/exponent-docs-v2:${TAG}"
33+
imagePullPolicy: Always
34+
ports:
35+
- containerPort: 80
36+
name: http
37+
resources:
38+
requests:
39+
cpu: 200m
40+
memory: 256Mi
41+
---
42+
apiVersion: v1
43+
kind: Service
44+
metadata:
45+
name: docs
46+
namespace: ${ENVIRONMENT}
47+
labels:
48+
app: docs
49+
heritage: "Tiller"
50+
release: docs
51+
chart: "next-docs-1.0.0"
52+
spec:
53+
selector:
54+
app: docs
55+
ports:
56+
- name: http
57+
port: 80
58+
targetPort: 3000
59+
---
60+
apiVersion: extensions/v1beta1
61+
kind: Ingress
62+
metadata:
63+
name: docs
64+
namespace: ${ENVIRONMENT}
65+
labels:
66+
app: docs
67+
heritage: "Tiller"
68+
release: docs
69+
chart: "next-docs-1.0.0"
70+
ssl: "true"
71+
annotations:
72+
kubernetes.io/ingress.class: "nginx"
73+
kubernetes.io/tls-acme: "true"
74+
spec:
75+
tls:
76+
- hosts:
77+
- ${INGRESS_HOSTNAME}
78+
secretName: docs-tls
79+
rules:
80+
- host: ${INGRESS_HOSTNAME}
81+
http:
82+
paths:
83+
- backend:
84+
serviceName: docs
85+
servicePort: 80
86+
path: /

lib/versions.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,4 @@ const LATEST_VERSION =
1616
? window._LATEST_VERSION
1717
: process.env.LATEST_VERSION;
1818

19-
module.exports = {
20-
VERSIONS,
21-
LATEST_VERSION,
22-
};
19+
export { VERSIONS, LATEST_VERSION };

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"update-search-index": "node ./scripts/update-search-index"
1818
},
1919
"dependencies": {
20+
"babel-plugin-root-import": "^5.1.0",
2021
"babel-plugin-transform-define": "1.3.0",
2122
"babel-runtime": "6.23.0",
2223
"cross-env": "5.0.1",
@@ -48,7 +49,6 @@
4849
"devDependencies": {
4950
"@babel/cli": "^7.0.0-beta.32",
5051
"@babel/core": "^7.0.0-beta.32",
51-
"babel-plugin-root-import": "^5.1.0",
5252
"concurrently": "^3.3.0",
5353
"lint-staged": "4.0.0",
5454
"shelljs": "^0.7.8"

0 commit comments

Comments
 (0)