generated from mantinedev/next-pages-template
-
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from ajnart/dev
Adding persistent storage
- Loading branch information
Showing
29 changed files
with
403 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Dockerfile | ||
.dockerignore | ||
node_modules | ||
npm-debug.log | ||
README.md | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
FROM nginx:alpine | ||
COPY ./out /usr/share/nginx/html | ||
FROM node:16-alpine | ||
WORKDIR /app | ||
ENV NODE_ENV production | ||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
COPY /next.config.js ./ | ||
COPY /public ./public | ||
COPY /package.json ./package.json | ||
|
||
# Automatically leverage output traces to reduce image size | ||
# https://nextjs.org/docs/advanced-features/output-file-tracing | ||
COPY --chown=nextjs:nodejs /.next/standalone ./ | ||
COPY --chown=nextjs:nodejs /.next/static ./.next/static | ||
|
||
USER nextjs | ||
EXPOSE 7575 | ||
ENV PORT 7575 | ||
VOLUME /app/data/configs | ||
CMD ["node", "server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Center, Loader, Select, Tooltip } from '@mantine/core'; | ||
import { setCookies } from 'cookies-next'; | ||
import { useEffect, useState } from 'react'; | ||
import { useConfig } from '../../tools/state'; | ||
|
||
export default function ConfigChanger() { | ||
const { config, loadConfig, setConfig, getConfigs } = useConfig(); | ||
const [configList, setConfigList] = useState([] as string[]); | ||
useEffect(() => { | ||
getConfigs().then((configs) => setConfigList(configs)); | ||
// setConfig(initialConfig); | ||
}, [config]); | ||
// If configlist is empty, return a loading indicator | ||
if (configList.length === 0) { | ||
return ( | ||
<Center> | ||
<Tooltip label={"Loading your configs. This doesn't load in vercel."}> | ||
<Loader /> | ||
</Tooltip> | ||
</Center> | ||
); | ||
} | ||
return ( | ||
<Select | ||
defaultValue={config.name} | ||
label="Config loader" | ||
onChange={(e) => { | ||
loadConfig(e ?? 'default'); | ||
setCookies('config-name', e ?? 'default', { maxAge: 60 * 60 * 24 * 30 }); | ||
}} | ||
data={ | ||
// If config list is empty, return the current config | ||
configList.length === 0 ? [config.name] : configList | ||
} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Select } from '@mantine/core'; | ||
import { useState } from 'react'; | ||
|
||
export default function SelectConfig(props: any) { | ||
const [value, setValue] = useState<string | null>(''); | ||
return ( | ||
<Select | ||
value={value} | ||
onChange={setValue} | ||
data={[ | ||
{ value: 'default', label: 'Default' }, | ||
{ value: 'yourmom', label: 'Your mom' }, | ||
]} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
7618bc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
myhomepage – ./
myhomepage-ajnart.vercel.app
myhomepage-git-master-ajnart.vercel.app
myhomepage-one.vercel.app