Skip to content

Commit

Permalink
containirize and env vars in config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
akyriako committed Jun 30, 2024
1 parent 60cb0d8 commit bcd2106
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ COPY package*.json ./
RUN npm install
COPY . .

EXPOSE 3000
EXPOSE 80

CMD ["npm", "start"]

40 changes: 40 additions & 0 deletions Dockerfile2
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## Base ########################################################################
# Use a larger node image to do the build for native deps (e.g., gcc, python)
FROM node:lts as base

# Reduce npm log spam and colour during install within Docker
ENV NPM_CONFIG_LOGLEVEL=warn
ENV NPM_CONFIG_COLOR=false

# We'll run the app as the `node` user, so put it in their home directory
WORKDIR /home/node/app
# Copy the source code over
COPY --chown=node:node . /home/node/app/

## Development #################################################################
# Define a development target that installs devDeps and runs in dev mode
FROM base as development
WORKDIR /home/node/app
# Install (not ci) with dependencies, and for Linux vs. Linux Musl (which we use for -alpine)
RUN npm install
# Switch to the node user vs. root
USER node
# Expose port 3000
EXPOSE 3000
# Start the app in debug mode so we can attach the debugger
CMD ["npm", "start"]

## Production ##################################################################
# Also define a production target which doesn't use devDeps
FROM base as production
WORKDIR /home/node/app
COPY --chown=node:node --from=development /home/node/app/node_modules /home/node/app/node_modules
# Build the Docusaurus app
RUN npm run build

## Deploy ######################################################################
# Use a stable nginx image
FROM nginx:stable-alpine as deploy
WORKDIR /home/node/app
# Copy what we've installed/built from production
COPY --chown=node:node --from=production /home/node/app/build /usr/share/nginx/html/
14 changes: 14 additions & 0 deletions docker-compose.debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.4'

services:
docsnext:
image: docsnext
build:
context: .
dockerfile: ./Dockerfile
environment:
NODE_ENV: development
ports:
- 3000:3000
- 9229:9229
command: ["node", "--inspect=0.0.0.0:9229", "index.js"]
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.4'

services:
docsnext:
image: docsnext
build:
context: .
dockerfile: ./Dockerfile
environment:
NODE_ENV: production
ports:
- 3000:3000
50 changes: 44 additions & 6 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const config: Config = {
favicon: 'img/favicon.ico',

// Set the production url of your site here
url: 'https://your-docusaurus-site.example.com',
url: 'https://blueprints.hypelens.de',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
Expand All @@ -17,6 +17,7 @@ const config: Config = {
// If you aren't using GitHub pages, you don't need these.
organizationName: 'akyriako', // Usually your GitHub org/user name.
projectName: 'docs-next', // Usually your repo name.
deploymentBranch: 'gh-pages',

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
Expand Down Expand Up @@ -85,7 +86,7 @@ const config: Config = {
// },
// { to: '/blog', label: 'Blog', position: 'right' },
{ href: 'https://auth.otc.t-systems.com/', label: 'Console', position: 'right' },
// { href: 'https://github.com/akyriako/docs-next', label: 'GitHub', position: 'right',},
{ href: 'https://github.com/akyriako/docs-next', label: 'GitHub', position: 'right',},
],
},
footer: {
Expand Down Expand Up @@ -172,6 +173,43 @@ const config: Config = {
autoCollapseCategories: true,
},
},
// typesense: {
// // Replace this with the name of your index/collection.
// // It should match the "index_name" entry in the scraper's "config.json" file.
// typesenseCollectionName: 'docs-next',
// typesenseServerConfig: {
// nearestNode: {
// host: 'typesense-headless.typesense.svc.cluster.local',
// port: 8108,
// protocol: 'http',
// },
// nodes: [
// {
// host: 'typesense-0.typesense-headless.typesense.svc.cluster.local',
// port: 8108,
// protocol: 'http',
// },
// {
// host: 'typesense-1.typesense-headless.typesense.svc.cluster.local',
// port: 8108,
// protocol: 'http',
// },
// {
// host: 'typesense-2.typesense-headless.typesense.svc.cluster.local',
// port: 8108,
// protocol: 'http',
// },
// ],
// apiKey: 'Mycomplexpassword#6546',
// },

// // Optional: Typesense search parameters: https://typesense.org/docs/0.24.0/api/search.html#search-parameters
// typesenseSearchParameters: {},

// // Optional
// contextualSearch: true,
// },

typesense: {
// Replace this with the name of your index/collection.
// It should match the "index_name" entry in the scraper's "config.json" file.
Expand All @@ -180,12 +218,12 @@ const config: Config = {
typesenseServerConfig: {
nodes: [
{
host: 'typesense-headless',
port: 8108,
protocol: 'http',
host: process.env.TYPESENSE_HOST,
port: process.env.TYPESENSE_PORT,
protocol: process.env.TYPESENSE_PROTOCOL,
},
],
apiKey: 'Mycomplexpassword#6546',
apiKey: process.env.TYPESENSE_API_KEY,
},

// Optional: Typesense search parameters: https://typesense.org/docs/0.24.0/api/search.html#search-parameters
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start --host 0.0.0.0",
"start": "docusaurus start --host 0.0.0.0 --port 80",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve --host 0.0.0.0",
"serve": "docusaurus serve --host 0.0.0.0 --port 80",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
Expand Down

0 comments on commit bcd2106

Please sign in to comment.