Skip to content

Commit 6526d36

Browse files
committed
fix: remove ENV variables and better structure files inside image
1 parent 4a1ae28 commit 6526d36

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

Dockerfile

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
# latest supported node version when this Dockerfile was written
2+
ARG NODE_VERSION=22.12.0-alpine
3+
ARG APP_DIR=/usr/src/parse
4+
15
# Builder stage
2-
FROM node:22.12.0-alpine AS builder
6+
FROM node:${NODE_VERSION} AS builder
37

4-
WORKDIR /usr/src/parse
8+
WORKDIR ${APP_DIR}
59

610
COPY package*.json .
711

@@ -11,20 +15,17 @@ COPY . .
1115

1216
RUN npm run build
1317

14-
# latest supported node version when this Dockerfile was written
15-
FROM node:22.12.0-alpine
18+
FROM node:${NODE_VERSION}
1619

17-
WORKDIR /usr/src/parse
20+
WORKDIR ${APP_DIR}
1821

1922
# Copy only the required files from the builder stage
20-
COPY --from=builder /usr/src/parse/node_modules ./node_modules
21-
COPY --from=builder /usr/src/parse/dist ./dist
22-
COPY --from=builder /usr/src/parse/public ./public
23+
COPY --from=builder ${APP_DIR}/node_modules ./node_modules
24+
COPY --from=builder ${APP_DIR}/dist ./
25+
COPY --from=builder ${APP_DIR}/public ./public
2326

24-
ENV APP_ID=setYourAppId
25-
ENV MASTER_KEY=setYourMasterKey
26-
ENV DATABASE_URI=setMongoDBURI
27+
VOLUME ["${APP_DIR}/cloud", "${APP_DIR}/logs"]
2728

2829
EXPOSE 1337
2930

30-
CMD ["node", "dist/index.js"]
31+
CMD ["node", "index.js"]

0 commit comments

Comments
 (0)