add dockerfile
This commit is contained in:
15
.dockerignore
Normal file
15
.dockerignore
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
README.md
|
||||||
|
.env
|
||||||
|
.nyc_output
|
||||||
|
coverage
|
||||||
|
.sass-cache
|
||||||
|
.cache
|
||||||
|
.tmp
|
||||||
|
.DS_Store
|
||||||
|
*.log
|
||||||
|
dist
|
||||||
|
.strapi-updater.json
|
||||||
29
Dockerfile
Normal file
29
Dockerfile
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Creating multi-stage build for production
|
||||||
|
FROM node:24-alpine as build
|
||||||
|
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev > /dev/null 2>&1
|
||||||
|
ARG NODE_ENV=production
|
||||||
|
ENV NODE_ENV=${NODE_ENV}
|
||||||
|
|
||||||
|
WORKDIR /opt/
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm config set fetch-retry-maxtimeout 600000 -g && npm install --only=production
|
||||||
|
ENV PATH=/opt/node_modules/.bin:$PATH
|
||||||
|
WORKDIR /opt/app
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Creating final production image
|
||||||
|
FROM node:24-alpine
|
||||||
|
RUN apk add --no-cache vips-dev
|
||||||
|
ARG NODE_ENV=production
|
||||||
|
ENV NODE_ENV=${NODE_ENV}
|
||||||
|
WORKDIR /opt/
|
||||||
|
COPY --from=build /opt/node_modules ./node_modules
|
||||||
|
WORKDIR /opt/app
|
||||||
|
COPY --from=build /opt/app ./
|
||||||
|
ENV PATH=/opt/node_modules/.bin:$PATH
|
||||||
|
|
||||||
|
RUN chown -R node:node /opt/app
|
||||||
|
USER node
|
||||||
|
EXPOSE 1337
|
||||||
|
CMD ["npm", "run", "start"]
|
||||||
@@ -3,7 +3,6 @@ services:
|
|||||||
container_name: takerofnotes
|
container_name: takerofnotes
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.prod
|
|
||||||
image: takerofnotes-cms:latest
|
image: takerofnotes-cms:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: .env
|
env_file: .env
|
||||||
|
|||||||
Reference in New Issue
Block a user