Comments (2)
Just managed to successfully host it on Docker 😁
steps:
-
replace the deprecated
nuxt-simple-sitemap
with@nuxtjs/sitemap
-
uncomment in nuxt.config.ts
routeRules: {
'/**': {
prerender: true,
},
},
- dockerfile
# build stage
FROM node:18-alpine as build-stage
WORKDIR /app
COPY package.json .
COPY pnpm-lock.yaml ./
RUN apk update
RUN apk add --no-cache git
RUN npm install -g [email protected]
RUN pnpm install
COPY . .
# ENV
ENV DIRECTUS_URL=${DIRECTUS_URL}
ENV DIRECTUS_SERVER_TOKEN=${DIRECTUS_SERVER_TOKEN}
ENV SITE_URL=${SITE_URL}
RUN NODE_OPTIONS="--max-old-space-size=4096" pnpm build
# production stage
FROM node:18-slim as production
COPY --from=build-stage /app/.output /app/.output
COPY --from=build-stage /app/node_modules /app/node_modules
EXPOSE 3000
CMD ["node", "/app/.output/server/index.mjs"]
- .dockerignore (not working without this, not sure why :) )
node_modules
npm-debug.log
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
- build
docker build -t test-website --build-arg DIRECTUS_URL='http://host.docker.internal:8055' --build-arg DIRECTUS_SERVER_TOKEN='...' --build-arg SITE_URL='http://localhost:3000' --build-arg NODE_OPTIONS="--max-old-space-size=4096" .
- start docker container
docker run --name test-website --network directus_default -p 3000:3000 -e "DIRECTUS_URL=http://localhost:8055" -e "DIRECTUS_SERVER_TOKEN=..." -e "SITE_URL=https://your_domain" --rm test-website
PS: in production, the DIRECTUS_URL & SITE_URL can't be localhost
PS 2: in .directus/docker-compose.yml you need to update CORS, else, the forms won't work
CORS_ENABLED: 'true'
CORS_ORIGIN: 'https://mywebsite.com,http://localhost:3000'
CORS_METHODS: GET,POST
from agency-os.
Thanks for the info and glad you got it working! As I do not see any issue outlined here I am going to close this for now, happy to re-open if needed.
from agency-os.
Related Issues (20)
- Some errors during in-docker database initial setup HOT 2
- Self-hosted Directus & Nuxt Agency OS issue HOT 4
- Frontend not load HOT 2
- NAV Bar not working fine HOT 4
- directus apply template doesn't work HOT 3
- Auto Selection Based on Current HOT 1
- Images cannot be loaded, files path not found HOT 4
- This module cannot be imported in server runtime || og-image not showing HOT 5
- docker compose on MacOS: "chown: changing ownership of '/var/lib/postgresql/data': Permission denied" HOT 1
- Extend globals HOT 1
- Pages navigation don't load page content HOT 1
- Unable to Load Images in Portal Due to 403 Error Despite Administrator Access HOT 10
- Image Outline Issue on Initial Load in `block_columns` Component
- [Question] Blog Posts - No Pagination
- publish module HOT 1
- Nuxt Frontend fails to run in development or production, Circular dependency issue `Export "useNitroApp"` HOT 1
- 404 error frontend when launching on vercel HOT 4
- Each page that uses [...permalink] gives 404 since latest Directus update? HOT 1
- Issue: Errors Encountered During Static Website Generation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agency-os.