Create Dockerfile for Railway deployment
cgen-eb4e617693514a0cb6a5135ff443854a
This commit is contained in:
parent
252e0ac577
commit
9fd6918a2f
1 changed files with 27 additions and 0 deletions
27
Dockerfile
Normal file
27
Dockerfile
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
FROM node:22-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files
|
||||||
|
COPY package.json package-lock.json* pnpm-lock.yaml* npm-shrinkwrap.json* ./
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN if [ -f pnpm-lock.yaml ]; then npm install -g pnpm && pnpm install --frozen-lockfile; \
|
||||||
|
elif [ -f package-lock.json ]; then npm ci; \
|
||||||
|
else npm install; fi
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the app (frontend + server)
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Set environment
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
ENV PORT=3000
|
||||||
|
|
||||||
|
# Expose port
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Start the server
|
||||||
|
CMD ["npm", "start"]
|
||||||
Loading…
Reference in a new issue