Skip to content

feat(docker): initial setup of Docker #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2024
Merged
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
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
npm-debug.log
build
.dockerignore
**/.git
**/.DS_Store
**/node_modules
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Base image
FROM node:18-alpine AS base
WORKDIR /app

COPY package.json /app/package.json
COPY package-lock.json /app/package-lock.json

ARG ENV=production
RUN if [ "$ENV" = "development" ]; then npm install; else npm ci --only=production; fi

COPY . /app

# Stage for production builds
FROM node:18-alpine AS production
WORKDIR /app
COPY --from=base /app /app

# Set environment variable for production
ENV NODE_ENV=production
ENV PORT=3000

EXPOSE 3000
CMD [ "npm", "start" ]
Loading