Skip to content
Snippets Groups Projects
Commit 4a992478 authored by Harsh Jain's avatar Harsh Jain
Browse files

env added

parent 9c4d7703
Branches dev
No related tags found
1 merge request!1env files removed
node_modules
Dockerfile
.dockerignore
\ No newline at end of file
.env 0 → 100644
PORT = 3000
\ No newline at end of file
node_modules
\ No newline at end of file
.env
\ No newline at end of file
version: "3.8"
services:
app_server:
container_name: app_server
image: app_server:1.0.0
build:
context: .
dockerfile: ./Dockerfile
command: npm run start
env_file: .env
ports: '3000:3000'
\ No newline at end of file
FROM node:18-alpine
WORKDIR /app
# Copy package.json and package-lock.json first (this leverages Docker cache for better efficiency)
COPY package.json .
COPY package-lock.json .
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Copy .env file if necessary for environment variables
COPY .env .env
# Expose the application port
EXPOSE 3000
# Command to run the application
CMD ["npm", "start"]
# Optionally, add a health check
# HEALTHCHECK CMD curl --fail http://localhost:3000/ || exit 1
......@@ -9,5 +9,5 @@ app.get('/', (req,res)=>{
});
app.listen(PORT, ()=>{
console.log(`Listening to http://localhost:3001`);
console.log(`Listening to http://localhost:${PORT}`);
})
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment