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", "version": "0.0.1",
"description": "", "description": "",
"author": "", "author": "",

View file

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

View file

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

View file

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