Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
feat(docker): dockerize project
Browse files Browse the repository at this point in the history
  • Loading branch information
noxzym committed Mar 23, 2024
1 parent 1131e47 commit a742e48
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build & Push Docker Image to container image registry

on:
release:
types: [created]
push:
branches:
- main
pull_request:
branches:
- main
paths:
- "Dockerfile"

jobs:
docker:
uses: clytage/workflows/.github/workflows/docker-build.yml@main
secrets: inherit
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM ghcr.io/hazmi35/node:20-dev-alpine as build-stage

# Prepare pnpm with corepack (experimental feature)
RUN corepack enable && corepack prepare pnpm@latest

# Copy package.json, lockfile and npm config files
COPY package.json pnpm-lock.yaml *.npmrc ./

# Fetch dependencies to virtual store
RUN pnpm fetch

# Install dependencies
RUN pnpm install --offline --frozen-lockfile

# Copy Project files
COPY . .

# Build TypeScript Project
RUN pnpm run build

# Prune devDependencies
RUN pnpm prune --production

# Get ready for production
FROM ghcr.io/hazmi35/node:20-alpine

LABEL name "bajigur"
LABEL maintainer "Stegripe <[email protected]>"

# Install ffmpeg
RUN apk add --no-cache ffmpeg

# Copy needed files
COPY --from=build-stage /tmp/build/package.json .
COPY --from=build-stage /tmp/build/node_modules ./node_modules
COPY --from=build-stage /tmp/build/dist ./dist

# Additional Environment Variables
ENV NODE_ENV production

# Add scripts volumes
VOLUME /app/auth_state

# Start the app with node
CMD ["node", "dist/index.js"]

0 comments on commit a742e48

Please sign in to comment.