Skip to content

Commit

Permalink
refactor(build): refactor build config and fix other smaller issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Boersteken, Philipp committed May 3, 2022
1 parent 490807e commit 6b06c70
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 3 additions & 3 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ ENV FSXA_NAVIGATION_SERVICE=...
ENV FSXA_MODE=...
ENV FSXA_TENANT_ID=...
COPY package*.json ./
RUN npm ci
RUN npm ci --no-optional
COPY . .
RUN npx nuxt build --config-file nuxt.config.ts --standalone \
&& rm -rf node_modules && \
NODE_ENV=production npm ci --production --silent \
&& NODE_ENV=production npm install [email protected]
NODE_ENV=production npm ci --production --silent --no-optional \
&& NODE_ENV=production npm install --no-optional [email protected]


FROM node:14.17.1-alpine3.13 AS runtime
Expand Down
26 changes: 16 additions & 10 deletions customRoutes/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,23 @@ export default {
error: 'No identifier was specified'
})
}
const media = await context.fsxaAPI.fetchElement({
id: req.params.identifier,
locale: req.query.locale as string
})
if (media.resolutions && media.resolutions.ORIGINAL) {
return res.redirect(media.resolutions.ORIGINAL.url)
try {
const media = await context.fsxaAPI.fetchElement({
id: req.params.identifier,
locale: req.query.locale as string
})
if (media.resolutions && media.resolutions.ORIGINAL) {
return res.redirect(media.resolutions.ORIGINAL.url)
}
res.send({
error: 'Unknown media type',
media
})
} catch (e) {
res.status(500).json({
error: (e as Error).message
})
}
res.send({
error: 'Unknown media type',
media
})
},
route: '/download/:identifier'
}
9 changes: 1 addition & 8 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,7 @@ const config: NuxtConfig = {
modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
[
'fsxa-nuxt-module',
{
NUXT_HOST: process.env.NUXT_HOST,
NUXT_PORT: process.env.NUXT_PORT,
FSXA_MODE: process.env.FSXA_MODE
}
]
'fsxa-nuxt-module'
],
/*
** Axios module configuration
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
},
"types": ["@types/node"]
},
"exclude": ["**/node_modules"]
"exclude": ["**/node_modules", "cypress/**"]
}

0 comments on commit 6b06c70

Please sign in to comment.