Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ssr' into ssr
Browse files Browse the repository at this point in the history
* origin/ssr:
  Remove build time environment variables
  Comment out early hints
  Build on container start
  Update the PUBLIC_URL domain in dev images
  Update the API domain
  • Loading branch information
davenquinn committed Sep 29, 2023
2 parents 4d78689 + 07f298f commit d98eaee
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 35 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,5 @@ jobs:
with:
context: .
push: true
build-args: |
VITE_MAPBOX_API_TOKEN=${{ secrets.MAPBOX_API_TOKEN }}
VITE_MACROSTRAT_TILESERVER_V1=https://tiles.macrostrat.org
VITE_MACROSTRAT_TILESERVER_DOMAIN=https://tileserver.macrostrat-dev.chtc.io
VITE_MACROSTRAT_API_DOMAIN=
VITE_CORELLE_API_DOMAIN=https://rotate.macrostrat.org
PUBLIC_URL=/map/
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
7 changes: 0 additions & 7 deletions .github/workflows/build-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
build-args: |
VITE_MAPBOX_API_TOKEN=${{ secrets.MAPBOX_API_TOKEN }}
VITE_MACROSTRAT_TILESERVER_V1=https://tiles.macrostrat.org
VITE_MACROSTRAT_TILESERVER_DOMAIN=https://tileserver.macrostrat-dev.chtc.io
VITE_MACROSTRAT_API_DOMAIN=
VITE_CORELLE_API_DOMAIN=https://rotate.macrostrat.org
PUBLIC_URL=/map/
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
21 changes: 1 addition & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
FROM node:20 AS build

ARG VITE_MAPBOX_API_TOKEN
ENV VITE_MAPBOX_API_TOKEN=$VITE_MAPBOX_API_TOKEN

ARG VITE_MACROSTRAT_TILESERVER_V2
ENV VITE_MACROSTRAT_TILESERVER_V2=$VITE_MACROSTRAT_TILESERVER_V2

ARG VITE_MACROSTRAT_TILESERVER_V1
ENV VITE_MACROSTRAT_TILESERVER_V1=$VITE_MACROSTRAT_TILESERVER_V1

ARG VITE_MACROSTRAT_TILESERVER_DOMAIN
ENV VITE_MACROSTRAT_TILESERVER_DOMAIN=$VITE_MACROSTRAT_TILESERVER_DOMAIN

ARG VITE_MACROSTRAT_API_DOMAIN
ENV VITE_MACROSTRAT_API_DOMAIN=$VITE_MACROSTRAT_API_DOMAIN

ARG VITE_CORELLE_API_DOMAIN
ENV VITE_CORELLE_API_DOMAIN=$VITE_CORELLE_API_DOMAIN

ENV NODE_ENV=production

WORKDIR /usr/src/app
COPY . ./

RUN yarn cache clean
RUN yarn add
RUN yarn run bundle

CMD ["yarn", "run", "server"]
CMD ["sh", "server/server.sh"]
2 changes: 1 addition & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async function startServer() {
return next()
} else {
const { body, statusCode, headers, earlyHints } = httpResponse
if (res.writeEarlyHints) res.writeEarlyHints({ link: earlyHints.map((e) => e.earlyHintLink) })
// if (res.writeEarlyHints) res.writeEarlyHints({ link: earlyHints.map((e) => e.earlyHintLink) })
headers.forEach(([name, value]) => res.setHeader(name, value))
res.status(statusCode)
if (!res.hasHeader('Content-Type')) res.setHeader('Content-Type', 'text/html');
Expand Down
2 changes: 2 additions & 0 deletions server/server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarn run bundle
yarn run server

0 comments on commit d98eaee

Please sign in to comment.