Skip to content

Instantly share code, notes, and snippets.

@Semdevmaster
Last active October 11, 2024 06:35
Show Gist options
  • Save Semdevmaster/deefff3b6fb0566d559c72d22fd27208 to your computer and use it in GitHub Desktop.
Save Semdevmaster/deefff3b6fb0566d559c72d22fd27208 to your computer and use it in GitHub Desktop.
Docker file build nuxt application
node_modules
.output
.nuxt
.git
.gitignore
*.md
.dockerignore
FROM node:lts-alpine3.20 AS build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable && corepack prepare pnpm@latest-9 --activate
COPY --chown=node:node . /var/www
WORKDIR /var/www
RUN pnpm install --frozen-lockfile && pnpm run build
FROM node:lts-alpine3.20
ARG TZ=Europe/Moscow
RUN apk add --no-cache alpine-conf && setup-timezone -z ${TZ} && apk del alpine-conf
COPY --from=build --chown=node:node /var/www/.output /var/www/.output
WORKDIR /var/www
USER node
EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment