Last active
September 23, 2021 10:08
-
-
Save Morgbn/0b3db063b4bbf2324f4e6c11a8cccbfb to your computer and use it in GitHub Desktop.
Fast (leverages the build cache) Nuxt.js Dockerfile with timezone + .dockerignore
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:12.18.3-alpine | |
ARG TZ='Europe/Paris' | |
ENV TZ ${TZ} | |
# Installs | |
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" > /etc/apk/repositories \ | |
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ | |
&& apk upgrade -U -a \ | |
&& apk add \ | |
tzdata \ | |
&& rm -rf /var/cache/* \ | |
&& mkdir /var/cache/apk | |
# set timezone | |
RUN cp /usr/share/zoneinfo/${TZ} /etc/localtime \ | |
&& echo "${TZ}" > /etc/timezone \ | |
&& apk del tzdata | |
# Create app directory | |
WORKDIR /src | |
# install dependencies | |
COPY package*.json ./ | |
RUN npm ci | |
COPY . . | |
RUN npm run build | |
# set app serving to permissive / assigned | |
ENV NUXT_HOST=0.0.0.0 | |
# set app port | |
ENV NUXT_PORT=5000 | |
# expose 5000 on container | |
EXPOSE 5000 | |
CMD [ "npm", "run", "start" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
📄
.dockerignore
:.git
.nuxt
/dist
/migrations
/node_modules
/uploads
.editorconfig
.env.example
docker-compose.production.yml
Dockerfile
npm-debug*
Procfile
README.md