🔧 Fixes to enable docker image build
This commit is contained in:
33
Dockerfile
33
Dockerfile
@@ -1,26 +1,29 @@
|
||||
FROM node:22.1.0
|
||||
LABEL maintainer="Rishi Ghan <rishi.ghan@gmail.com>"
|
||||
|
||||
# Working directory
|
||||
# Set working directory
|
||||
WORKDIR /acquisition-service
|
||||
# Install dependencies
|
||||
|
||||
# Copy package files first for efficient caching
|
||||
COPY package.json package-lock.json ./
|
||||
COPY moleculer.config.ts ./
|
||||
COPY tsconfig.json ./
|
||||
COPY tsconfig.build.json ./
|
||||
|
||||
# Install application dependencies
|
||||
RUN npm install
|
||||
RUN npm install -g typescript ts-node
|
||||
# Install all dependencies (including devDependencies)
|
||||
RUN npm install
|
||||
|
||||
# Copy source
|
||||
# Copy necessary config files
|
||||
COPY moleculer.config.ts tsconfig.json tsconfig.build.json ./
|
||||
|
||||
# Copy the rest of the source code
|
||||
COPY . .
|
||||
|
||||
# Build and cleanup
|
||||
ENV NODE_ENV=production
|
||||
RUN npm run build \
|
||||
&& npm prune
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Now remove devDependencies to keep the final image small
|
||||
RUN npm prune --omit=dev
|
||||
|
||||
# Expose the port
|
||||
EXPOSE 3080
|
||||
# Start server
|
||||
CMD ["npm", "start"]
|
||||
|
||||
# Start the application
|
||||
CMD ["npm", "start"]
|
||||
|
||||
Reference in New Issue
Block a user