feat: Add Docker support and fix build issues
This commit is contained in:
parent
c6ce63b6fa
commit
c16dc1d694
3 changed files with 68 additions and 1 deletions
35
Dockerfile
Normal file
35
Dockerfile
Normal file
|
@ -0,0 +1,35 @@
|
|||
FROM node:20-alpine AS builder
|
||||
|
||||
RUN mkdir -p /data && chown node:node /data
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json .
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||
|
||||
COPY package.json .
|
||||
RUN npm install --omit=dev
|
||||
|
||||
RUN mkdir -p /data
|
||||
RUN touch /data/portal-btc.db
|
||||
|
||||
COPY --from=builder /app/build .
|
||||
|
||||
VOLUME /data
|
||||
RUN chown -R appuser:appgroup /app /data
|
||||
|
||||
USER appuser
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["node", "index.js"]
|
Loading…
Add table
Add a link
Reference in a new issue