Skip to content

Commit 6d8da1a

Browse files
chore: dockerizing app
1 parent bb02dd3 commit 6d8da1a

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

.dockerignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
node_modules
2+
.build
3+
.cache
4+
dist
5+
.tmp
6+
.tmp/*
7+
coverage
8+
9+
.git
10+
.gitignore
11+
12+
Dockerfile
13+
docker-compose.yml
14+
.env
15+
16+
npm-debug.log
17+
yarn-error.log
18+

Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
ARG NODE_VERSION=20-alpine
2+
3+
FROM node:${NODE_VERSION} AS deps
4+
WORKDIR /app
5+
6+
RUN corepack enable || true
7+
8+
COPY package.json yarn.lock ./
9+
RUN yarn install --frozen-lockfile
10+
11+
FROM node:${NODE_VERSION} AS build
12+
WORKDIR /app
13+
14+
RUN corepack enable || true
15+
16+
COPY --from=deps /app/node_modules ./node_modules
17+
COPY . .
18+
19+
ENV NODE_OPTIONS=--max_old_space_size=4096
20+
RUN yarn build
21+
22+
FROM node:${NODE_VERSION} AS runtime
23+
WORKDIR /app
24+
25+
ENV NODE_ENV=production
26+
ENV TZ=America/Sao_Paulo
27+
28+
RUN addgroup -S strapi && adduser -S strapi -G strapi
29+
30+
COPY --from=build --chown=strapi:strapi /app /app
31+
32+
USER strapi
33+
34+
EXPOSE 1337
35+
36+
CMD ["node", "node_modules/@strapi/strapi/bin/strapi.js", "start"]
37+

0 commit comments

Comments
 (0)