-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c11d3e2
commit 53f47a3
Showing
1 changed file
with
21 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
# Stage 1: Build the app | ||
FROM node:22 AS build | ||
FROM node:17-stretch | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Copy the package.json and package-lock.json to the working directory | ||
COPY package*.json ./ | ||
|
||
# Install the dependencies | ||
RUN npm install --only=production | ||
RUN npm install | ||
RUN git --version | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
COPY src ./src | ||
RUN ls ./ | ||
|
||
# Build the app | ||
RUN npm run build | ||
#ARG NODE_ENV=prod | ||
#ENV NODE_ENV=${NODE_ENV} | ||
|
||
# Stage 2: Create a smaller image for running the app | ||
FROM node:22-slim | ||
#COPY tools ./tools | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
# placeholders for validation | ||
RUN [ "touch",".env"] | ||
RUN [ "touch",".env.staging"] | ||
RUN [ "touch",".env.dev"] | ||
RUN [ "touch",".env.production"] | ||
|
||
COPY tsconfig.json . | ||
COPY tsconfig.build.json . | ||
|
||
RUN [ "npm", "run", "build"] | ||
|
||
# Copy the built app from the build stage | ||
COPY --from=build /app . | ||
|
||
# Expose the application port (adjust if necessary) | ||
EXPOSE 8080 | ||
|
||
# Start the app | ||
CMD ["npm", "run", "start:prod"] | ||
CMD [ "npm", "run", "start" ] | ||
# COPY entrypoint.sh . | ||
# ENTRYPOINT [ "/app/entrypoint.sh" ] |