feat: docker image building

This commit is contained in:
Kakious 2024-11-22 21:25:20 -05:00
parent 9689a328b9
commit 97c1a160ad
6 changed files with 83 additions and 21 deletions

View file

@ -0,0 +1,41 @@
on: [push]
jobs:
build:
runs-on: docker
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to git.kakio.us
uses: docker/login-action@v3.3.0
with:
registry: git.kakio.us
username: kakious
password: ${{ secrets.REPO_PUSH }}
- name: Build and push frontend
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
target: frontend
tags: |
git.kakio.us/kakious/authcore-frontend:latest
git.kakio.us/kakious/authcore-frontend:${{ github.sha }}
- name: Build and push backend
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
target: backend
tags: |
git.kakio.us/kakious/authcore-backend:latest
git.kakio.us/kakious/authcore-backend:${{ github.sha }}

24
Dockerfile Normal file
View file

@ -0,0 +1,24 @@
FROM node:22-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 --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run -r build
RUN pnpm deploy --filter=backend --prod /prod/backend
RUN pnpm deploy --filter=frontend --prod /prod/frontend
FROM base AS backend
COPY --from=build /prod/backend /usr/src/app
WORKDIR /usr/src/app
EXPOSE 3001
CMD ["pnpm", "start"]
FROM base AS frontend
COPY --from=build /prod/frontend /usr/src/app
WORKDIR /usr/src/app
EXPOSE 3000
CMD ["pnpm", "start"]

View file

@ -1,5 +1,5 @@
{
"name": "waterwolf-oauth-core",
"name": "backend",
"version": "0.0.1",
"description": "",
"author": "",
@ -114,4 +114,4 @@
"testEnvironment": "node"
},
"packageManager": "pnpm@9.5.0+sha512.140036830124618d624a2187b50d04289d5a087f326c9edfc0ccd733d76c4f52c3a313d4fc148794a2a9d81553016004e6742e8cf850670268a7387fc220c903"
}
}

View file

@ -1,21 +1,21 @@
import type { Metadata } from "next";
import localFont from "next/font/local";
import "./globals.css";
import type { Metadata } from 'next';
import localFont from 'next/font/local';
import './globals.css';
const geistSans = localFont({
src: "./fonts/GeistVF.woff",
variable: "--font-geist-sans",
weight: "100 900",
src: './fonts/GeistVF.woff',
variable: '--font-geist-sans',
weight: '100 900',
});
const geistMono = localFont({
src: "./fonts/GeistMonoVF.woff",
variable: "--font-geist-mono",
weight: "100 900",
src: './fonts/GeistMonoVF.woff',
variable: '--font-geist-mono',
weight: '100 900',
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: 'Create Next App',
description: 'Generated by create next app',
};
export default function RootLayout({
@ -25,11 +25,7 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>{children}</body>
</html>
);
}

View file

@ -1,4 +1,4 @@
import Image from "next/image";
import Image from 'next/image';
export default function Home() {
return (
@ -14,7 +14,7 @@ export default function Home() {
/>
<ol className="list-inside list-decimal text-sm text-center sm:text-left font-[family-name:var(--font-geist-mono)]">
<li className="mb-2">
Get started by editing{" "}
Get started by editing{' '}
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold">
src/app/page.tsx
</code>

View file

@ -4,7 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"dev": "pnpm run --parallel dev"
"dev": "pnpm run --parallel dev",
"build": "pnpm run --parallel build"
},
"keywords": [],
"author": "",