Skip to content

Instantly share code, notes, and snippets.

@Eventyret
Last active July 18, 2024 09:18
Show Gist options
  • Save Eventyret/16ab3dcbd22c297fec9aac73d22fb3d3 to your computer and use it in GitHub Desktop.
Save Eventyret/16ab3dcbd22c297fec9aac73d22fb3d3 to your computer and use it in GitHub Desktop.
Dockerfile used with strapi-dockerize-tool
FROM {{ nodeVersion }}-alpine
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
WORKDIR /opt/
{%- if packageManager == "yarn" %}
COPY package.json yarn.lock ./
RUN yarn config set network-timeout 600000 -g && yarn install
{%- else %}
COPY package.json package-lock.json ./
RUN npm config set fetch-retry-maxtimeout 600000 -g && npm install
{%- endif %}
WORKDIR /opt/app
COPY . .
ENV PATH /opt/node_modules/.bin:$PATH
RUN chown -R node:node /opt/app
USER node
{%- if packageManager == "yarn" %}
RUN ["yarn", "build"]
{%- else %}
RUN ["npm", "run", "build"]
{%- endif %}
EXPOSE 1337
{%- if packageManager == "yarn" %}
CMD ["yarn", "develop"]
{%- else %}
CMD ["npm", "run", "develop"]
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment