Skip to content

Commit

Permalink
"small" tweaks (#16)
Browse files Browse the repository at this point in the history
* updated config to new flux method

* no build args other than version

* refactor and fix html template
  • Loading branch information
Francois Laubscher committed Aug 2, 2019
1 parent 3119b28 commit 8b4728b
Show file tree
Hide file tree
Showing 18 changed files with 1,783 additions and 1,537 deletions.
3 changes: 1 addition & 2 deletions .babelrc
Expand Up @@ -7,7 +7,6 @@
"@babel/plugin-syntax-dynamic-import",
"babel-plugin-styled-components",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-class-properties",
"transform-inline-environment-variables"
"@babel/plugin-proposal-class-properties"
]
}
2 changes: 1 addition & 1 deletion .buildkite/ci.sh
Expand Up @@ -14,4 +14,4 @@ export DOCKER_TAG="carbon:${BUILD_NUMBER}"
echo "+++ :package: Building version ${BUILD_NUMBER}"

# Build docker image
docker build -t ${DOCKER_TAG} --build-arg VERSION=${BUILD_NUMBER} --build-arg PUBLIC_URL=${PUBLIC_URL} .
docker build -t ${DOCKER_TAG} --build-arg VERSION=${BUILD_NUMBER} .
15 changes: 6 additions & 9 deletions Dockerfile
@@ -1,21 +1,18 @@
FROM leadhome/react-snap-base-image:1 as build
ENV NODE_ENV=production
ARG VERSION=0.0.0
ENV VERSION=${VERSION}

USER root
WORKDIR /app
ADD package*.json ./
RUN npm install
ADD . ./
RUN npm run build

# set all env vars now after deps have been installed, but before the build.
ARG PUBLIC_URL=
FROM docker.io/leadhome/nginx-node-alpine-base-image:1.0.7 as runtime
ARG VERSION=0.0.0

ENV PUBLIC_URL=${PUBLIC_URL}
ENV VERSION=${VERSION}
ENV NODE_ENV=production

RUN npm run build

FROM nginx:alpine as runtime
COPY --from=build /app/build/ /usr/share/nginx/html/

ADD ./nginx-entrypoint.sh /nginx-entrypoint.sh
Expand Down
8 changes: 3 additions & 5 deletions nginx-entrypoint.sh
@@ -1,7 +1,5 @@
envsubst '${API_URL}${PUBLIC_URL}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf

# Replace env vars in html template -- if any
cp /usr/share/nginx/html/index.html /usr/share/nginx/html/index.template.html
envsubst < /usr/share/nginx/html/index.html > /usr/share/nginx/html/index.html
#! /bin/sh
envsubst '${API_URL}${WP_URL}${PUBLIC_URL}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
envsubfolder /usr/share/nginx/html

exec nginx -g 'daemon off;'
6 changes: 5 additions & 1 deletion nginx.conf
Expand Up @@ -37,8 +37,12 @@ http {
expires 1y;
}

location ${PUBLIC_URL}/api {
location ${PUBLIC_URL}api {
proxy_pass ${API_URL};
}

location ${PUBLIC_URL}wp {
proxy_pass ${WP_URL};
}
}
}

0 comments on commit 8b4728b

Please sign in to comment.