Last active
March 23, 2021 14:33
-
-
Save Gomah/876f15355a636ad105e36d5a41bfd366 to your computer and use it in GitHub Desktop.
Nuxt.js Dockerfile :: Now.sh
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
FROM node:10-alpine | |
# Create app directory | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
# Install app dependencies | |
COPY package.json /usr/src/app/ | |
COPY yarn.lock /usr/src/app/ | |
RUN yarn install | |
# Set environment variables | |
ENV NODE_ENV production | |
ENV NUXT_HOST 0.0.0.0 | |
ENV NUXT_PORT 3000 | |
# Bundle app source | |
COPY . /usr/src/app | |
RUN yarn build | |
# Clear the cache | |
RUN yarn cache clean | |
EXPOSE 3000 | |
CMD [ "yarn", "start" ] |
Have you considered building the nuxt app files before building the image?
@blowsie - Yes, but Nuxt does not support dynamic runtime environment: nuxt/nuxt#5100
sure, but there are known work arounds
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@crezy231, unfortunately not, I recommend using the nuxt-builder for now v2: https://github.com/nuxt/now-builder
This Dockerfile can still be used in v1 (https://zeit.co/blog/serverless-docker) or in any container service.