Skip to content

Commit

Permalink
feat: adding docker images and compose
Browse files Browse the repository at this point in the history
  • Loading branch information
aacevski committed Jan 25, 2025
1 parent 43a0b39 commit 537b47e
Show file tree
Hide file tree
Showing 23 changed files with 656 additions and 5,260 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Docker Build, Changelog, and Release

on:
push:
branches:
- master

jobs:
build-and-push-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/your-repo-name:latest
ghcr.io/${{ github.repository_owner }}/your-repo-name:${{ github.sha }}
generate-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Generate changelog with conventional commits
id: changelog
uses: conventional-changelog/action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
preset: conventionalcommits
output-file: CHANGELOG.md

- name: Commit changelog
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add CHANGELOG.md
git commit -m "chore: Update changelog"
git push
create-release:
runs-on: ubuntu-latest
needs: [build-and-push-docker, generate-changelog]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Create GitHub release
id: create-release
uses: actions/create-release@v1
with:
tag_name: v1.0.0-${{ github.sha }}
release_name: Release v1.0.0-${{ github.sha }}
body: ${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pnpm dlx commitlint --edit $1
bun x commitlint --edit $1
3 changes: 1 addition & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pnpm dlx turbo format-and-lint
pnpm dlx turbo check-types
bun x biome ci .
33 changes: 33 additions & 0 deletions apps/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM --platform=$BUILDPLATFORM node:lts-slim AS base
WORKDIR /app

COPY package.json .
COPY bun.lockb .
COPY apps/api/package.json ./apps/api/package.json
COPY packages/typescript-config/package.json ./packages/typescript-config/package.json

RUN npm i -g bun

FROM base AS all-deps
RUN bun install

FROM base AS prod-deps
RUN bun install

FROM all-deps AS build
ENV NODE_ENV=production

COPY ./apps/api ./apps/api

FROM oven/bun:alpine AS runtime
WORKDIR /app

COPY --from=prod-deps /app/node_modules ./node_modules

COPY --from=build /app/apps/api ./apps/api

ENV NODE_ENV=production

WORKDIR /app/apps/api

CMD ["bun", "run", "src/index.ts"]
67 changes: 67 additions & 0 deletions apps/api/drizzle/0001_mean_ultimo.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
PRAGMA foreign_keys=OFF;--> statement-breakpoint
CREATE TABLE `__new_project` (
`id` text PRIMARY KEY NOT NULL,
`workspace_id` text NOT NULL,
`name` text NOT NULL,
`description` text,
`created_at` integer DEFAULT '"2025-01-25T16:10:08.340Z"' NOT NULL,
FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE cascade ON DELETE cascade
);
--> statement-breakpoint
INSERT INTO `__new_project`("id", "workspace_id", "name", "description", "created_at") SELECT "id", "workspace_id", "name", "description", "created_at" FROM `project`;--> statement-breakpoint
DROP TABLE `project`;--> statement-breakpoint
ALTER TABLE `__new_project` RENAME TO `project`;--> statement-breakpoint
PRAGMA foreign_keys=ON;--> statement-breakpoint
CREATE TABLE `__new_task` (
`id` text PRIMARY KEY NOT NULL,
`project_id` text NOT NULL,
`assignee_id` text NOT NULL,
`title` text NOT NULL,
`description` text,
`status` text DEFAULT 'to-do' NOT NULL,
`due_date` integer,
`created_at` integer DEFAULT '"2025-01-25T16:10:08.340Z"' NOT NULL,
FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON UPDATE cascade ON DELETE cascade,
FOREIGN KEY (`assignee_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade
);
--> statement-breakpoint
INSERT INTO `__new_task`("id", "project_id", "assignee_id", "title", "description", "status", "due_date", "created_at") SELECT "id", "project_id", "assignee_id", "title", "description", "status", "due_date", "created_at" FROM `task`;--> statement-breakpoint
DROP TABLE `task`;--> statement-breakpoint
ALTER TABLE `__new_task` RENAME TO `task`;--> statement-breakpoint
CREATE TABLE `__new_user` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`password` text NOT NULL,
`email` text NOT NULL,
`created_at` integer DEFAULT '"2025-01-25T16:10:08.340Z"' NOT NULL
);
--> statement-breakpoint
INSERT INTO `__new_user`("id", "name", "password", "email", "created_at") SELECT "id", "name", "password", "email", "created_at" FROM `user`;--> statement-breakpoint
DROP TABLE `user`;--> statement-breakpoint
ALTER TABLE `__new_user` RENAME TO `user`;--> statement-breakpoint
CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint
CREATE TABLE `__new_workspace` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`description` text,
`owner_id` text NOT NULL,
`created_at` integer DEFAULT '"2025-01-25T16:10:08.340Z"' NOT NULL,
FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade
);
--> statement-breakpoint
INSERT INTO `__new_workspace`("id", "name", "description", "owner_id", "created_at") SELECT "id", "name", "description", "owner_id", "created_at" FROM `workspace`;--> statement-breakpoint
DROP TABLE `workspace`;--> statement-breakpoint
ALTER TABLE `__new_workspace` RENAME TO `workspace`;--> statement-breakpoint
CREATE TABLE `__new_workspace_member` (
`id` text PRIMARY KEY NOT NULL,
`workspace_id` text NOT NULL,
`user_id` text NOT NULL,
`role` text,
`joined_at` integer DEFAULT '"2025-01-25T16:10:08.340Z"' NOT NULL,
FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE cascade ON DELETE cascade,
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE cascade ON DELETE cascade
);
--> statement-breakpoint
INSERT INTO `__new_workspace_member`("id", "workspace_id", "user_id", "role", "joined_at") SELECT "id", "workspace_id", "user_id", "role", "joined_at" FROM `workspace_member`;--> statement-breakpoint
DROP TABLE `workspace_member`;--> statement-breakpoint
ALTER TABLE `__new_workspace_member` RENAME TO `workspace_member`;
Loading

0 comments on commit 537b47e

Please sign in to comment.