Skip to content

Commit

Permalink
Update Dockerfile (#1060)
Browse files Browse the repository at this point in the history
add comments and merge volumes into single layer
  • Loading branch information
AranavMahalpure authored Oct 31, 2024
1 parent d685a21 commit d006d8b
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
FROM node:20.10.0-bullseye-slim

# Set working directory
WORKDIR /app
VOLUME [ "/app/db" ]
VOLUME [ "/app/assets" ]
VOLUME [ "/app/dist/assets" ]
VOLUME [ "/app/extras" ]

# Define volumes for persistent data storage
VOLUME [ "/app/db", "/app/assets", "/app/dist/assets", "/app/extras" ]

# Install pnpm globally
RUN npm install [email protected] -g

# SHA used for versioning
ARG SHA=unknown

# Add package files and install dependencies
ADD package.json pnpm-lock.yaml ./
RUN pnpm i --frozen-lockfile

# Add configuration and source files
ADD tailwind.config.js tsconfig.json .babelrc .postcssrc .prettierrc srv.tsconfig.json ./
ADD common/ ./common/
ADD srv/ ./srv/
ADD web/ ./web

# Build the server and replace SHA in index.html
RUN pnpm run build:server && \
sed -i "s/{{unknown}}/${SHA}/g" /app/web/index.html && \
pnpm run build && mkdir -p /app/assets && \
echo "${SHA}" > /app/version.txt
sed -i "s/{{unknown}}/${SHA}/g" /app/web/index.html && \
pnpm run build && mkdir -p /app/assets && \
echo "${SHA}" > /app/version.txt

# Set environment variables
ENV LOG_LEVEL=info \
INITIAL_USER=administrator \
DB_NAME=agnai \
ASSET_FOLDER=/app/dist/assets
INITIAL_USER=administrator \
DB_NAME=agnai \
ASSET_FOLDER=/app/dist/assets

# Expose application ports
EXPOSE 3001
EXPOSE 5001

# Set the entry point and default command
ENTRYPOINT [ "pnpm" ]
CMD ["run", "server"]
CMD ["run", "server"]

0 comments on commit d006d8b

Please sign in to comment.