mirror of
https://github.com/Dokploy/templates
synced 2025-06-26 18:16:07 +00:00
Add GitHub Actions workflow and Dockerfile for Docker image deployment
This commit is contained in:
36
app/Dockerfile
Normal file
36
app/Dockerfile
Normal file
@@ -0,0 +1,36 @@
|
||||
FROM node:20.9-slim AS base
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
|
||||
FROM base AS build
|
||||
COPY . /usr/src/app
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
RUN apt-get update && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install dependencies
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
|
||||
# Deploy only the dokploy app
|
||||
ENV NODE_ENV=production
|
||||
RUN pnpm build
|
||||
|
||||
FROM base AS dokploy
|
||||
WORKDIR /app
|
||||
|
||||
# Set production
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Copy only the necessary files
|
||||
COPY --from=build /usr/src/app/dist ./dist
|
||||
COPY --from=build /usr/src/app/package.json ./package.json
|
||||
COPY --from=build /usr/src/app/node_modules ./node_modules
|
||||
|
||||
# Copy templates folder
|
||||
COPY ../templates ./public/templates
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
CMD HOSTNAME=0.0.0.0 && pnpm start
|
||||
Reference in New Issue
Block a user