Working docker file.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
/node_modules
|
||||
.ds_store
|
||||
/dist
|
||||
*.rdb
|
||||
12
Dockerfile
12
Dockerfile
@@ -28,12 +28,12 @@ RUN apk update
|
||||
# Install runtime dependencies including AWS CLI v2
|
||||
RUN apk add --no-cache bash redis ghostscript graphicsmagick imagemagick libjpeg-turbo libpng libwebp tiff libheif libde265 x265 ffmpeg curl unzip gcompat tzdata
|
||||
|
||||
# Install AWS CLI v2
|
||||
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
|
||||
unzip awscliv2.zip && \
|
||||
./aws/install && \
|
||||
rm -rf awscliv2.zip aws/ && \
|
||||
aws --version
|
||||
# # Install AWS CLI v2
|
||||
# RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
|
||||
# unzip awscliv2.zip && \
|
||||
# ./aws/install && \
|
||||
# rm -rf awscliv2.zip aws/ && \
|
||||
# aws --version
|
||||
|
||||
RUN npm install -g pm2
|
||||
|
||||
|
||||
51
Dockerfile.dev
Normal file
51
Dockerfile.dev
Normal file
@@ -0,0 +1,51 @@
|
||||
### ALPINE MULTI-STAGE
|
||||
# Build stage for libraries
|
||||
FROM node:22-alpine AS builder
|
||||
|
||||
# Install build dependencies including AWS CLI v2
|
||||
RUN apk add --no-cache bash wget curl unzip gcompat
|
||||
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
|
||||
unzip awscliv2.zip && \
|
||||
./aws/install && \
|
||||
rm -rf awscliv2.zip aws/
|
||||
|
||||
# Node.js application build stage
|
||||
WORKDIR /usr/src/app
|
||||
COPY package*.json ./
|
||||
RUN npm install -g typescript
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Final stage
|
||||
FROM node:22-alpine
|
||||
|
||||
# Enable community repository for additional packages
|
||||
RUN echo "https://dl-cdn.alpinelinux.org/alpine/v$(grep -oE '[0-9]+\.[0-9]+' /etc/alpine-release)/community" >> /etc/apk/repositories
|
||||
RUN apk update
|
||||
|
||||
# Install runtime dependencies including AWS CLI v2
|
||||
RUN apk add --no-cache bash redis ghostscript graphicsmagick imagemagick libjpeg-turbo libpng libwebp tiff libheif libde265 x265 ffmpeg curl unzip gcompat tzdata
|
||||
|
||||
# Install AWS CLI v2
|
||||
# RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
|
||||
# unzip awscliv2.zip && \
|
||||
# ./aws/install && \
|
||||
# rm -rf awscliv2.zip aws/ && \
|
||||
# aws --version
|
||||
|
||||
RUN npm install -g pm2
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Copy built application from builder
|
||||
COPY --from=builder /usr/src/app/dist ./dist
|
||||
COPY ./assets /assets
|
||||
COPY --from=builder /usr/src/app/node_modules ./node_modules
|
||||
COPY --from=builder /usr/src/app/.env.production ./.env.production
|
||||
COPY --from=builder /usr/src/app/ecosystem.config.cjs ./ecosystem.config.cjs
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["sh", "-c", "redis-server --daemonize yes && npm run server"]
|
||||
24
docker-compose.override.yml
Normal file
24
docker-compose.override.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
# Development override - automatically used by docker compose
|
||||
# This file enables hot reloading and development features
|
||||
|
||||
services:
|
||||
ims:
|
||||
build:
|
||||
dockerfile: Dockerfile.dev
|
||||
volumes:
|
||||
# Mount source code for hot reloading
|
||||
- .:/usr/src/app
|
||||
- /usr/src/app/node_modules # Prevent overwriting node_modules
|
||||
- "/Users/pfic/Desktop/IMS:/media"
|
||||
- "./logs:/usr/src/app/logs"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- PORT=8000
|
||||
- MEDIA_PATH=/media
|
||||
- DUPLICATE_BILL_TO_VENDOR=false
|
||||
- IMS_TOKEN=
|
||||
- CONVERT_QUALITY=0.5
|
||||
- KEEP_CONVERTED_ORIGINALS=TRUE
|
||||
# command: redis-server && npm run server # Use nodemon for hot reloading
|
||||
stdin_open: true
|
||||
tty: true
|
||||
@@ -1,12 +1,20 @@
|
||||
version: '2'
|
||||
# Production configuration - use with docker-compose.override.yml for development
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
ims:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- 8000:8000
|
||||
- "8000:8000"
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- "/Users/pfic/Desktop/IMS:/media"
|
||||
- "./logs:/usr/src/app/logs" # Mount logs directory for persistence
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- PORT=8000
|
||||
- MEDIA_PATH=/media
|
||||
- DUPLICATE_BILL_TO_VENDOR=false
|
||||
- IMS_TOKEN=
|
||||
@@ -18,4 +26,10 @@ services:
|
||||
# - S3_ACCESS_KEY_ID=your-access-key-id
|
||||
# - S3_SECRET_ACCESS_KEY=your-secret-access-key
|
||||
# - S3_KEY_PREFIX=jobs/
|
||||
image: imexonline/media-server:beta
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
Reference in New Issue
Block a user