Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 9 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
# --- Build Stage ---
FROM node:alpine3.20 AS builder
# Base image
FROM node:alpine3.20

# Set working directory
WORKDIR /app

# Copy package files and install all dependencies
COPY package*.json ./
# Copy package files and install dependencies
COPY package.json ./
RUN npm install

# Copy application files
COPY . .


# --- Production Stage ---
FROM node:alpine3.20

WORKDIR /app

# Only install production dependencies for a smaller, safer image
COPY package*.json ./
RUN npm install --only=production

# Copy the app from the 'builder' stage
COPY --from=builder /app .

# Expose the port
# Expose the application port (server_port)
EXPOSE 5000

# run the app
CMD ["node", "index.js"]
# Command to run the application
CMD ["npm", "start"]
20 changes: 0 additions & 20 deletions __test__/healthcheck.test.js

This file was deleted.

20 changes: 5 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,9 @@ if (process.env.NODE_ENV === "production") {

app.use(errorHandler);

app.get("/healthz", (req, res) => {
res.status(200).send("OK");
});
mongoose.set("strictQuery", true);

export default app;

const startServer = () => {
mongoose
.connect(CONNECTION_URL, { dbName: DB_NAME })
.then(() => app.listen(PORT, () => console.log(`Server running on port: ${PORT}`)))
.catch((error) => console.log(error.message));
};

if (process.env.NODE_ENV !== "test") {
startServer();
}
mongoose
.connect(CONNECTION_URL, { dbName: DB_NAME })
.then(() => app.listen(PORT, () => console.log(`Server running on port: ${PORT}`)))
.catch((error) => console.log(error.message));
84 changes: 0 additions & 84 deletions terraform/main.tf

This file was deleted.

Loading