Compare commits

...

3 commits

Author SHA1 Message Date
0b51ccfd40 .
Some checks failed
Build and Push Docker / build-and-push (push) Has been cancelled
2025-06-27 01:14:04 -06:00
0852567bf4 . 2025-06-27 01:13:03 -06:00
056693a1f5 Add Dockerfile 2025-06-27 01:10:06 -06:00
4 changed files with 62 additions and 16 deletions

5
.dockerignore Normal file
View file

@ -0,0 +1,5 @@
node_modules
dist
.git
.env
.vscode

View file

@ -1,16 +0,0 @@
on:
workflow_dispatch:
push:
jobs:
build:
runs-on: docker
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'latest'
check-latest: true
cache: 'yarn'
- run: |
yarn build

38
.github/workflows/build-docker.yaml vendored Normal file
View file

@ -0,0 +1,38 @@
name: Build and Push Docker
on:
workflow_dispatch:
push:
branches:
- dev
- prod
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
#- name: Set up Tailscale
# uses: tailscale/github-action@v2
# with:
# authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/soc-site:${{ BRANCH_NAME }}

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM node:24-alpine AS builder
WORKDIR /app
COPY . .
RUN yarn install --frozen-lockfile
RUN yarn build
FROM node:24-alpine AS dependencies
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --production --frozen-lockfile
FROM node:24-alpine AS runner
WORKDIR /app
ENV HOST=0.0.0.0
ENV PORT=80
EXPOSE 80
COPY --from=builder /app/dist ./dist
COPY --from=dependencies /app/node_modules ./node_modules
CMD ["node", "./dist/server/entry.mjs"]