Test github action
Some checks are pending
Build Docker image / setup (push) Waiting to run

This commit is contained in:
Jorge Vargas 2025-06-27 17:16:34 -06:00
parent 0b51ccfd40
commit 9b316b09b4
7 changed files with 7181 additions and 10212 deletions

View file

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

View file

@ -1,38 +0,0 @@
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 }}

52
.github/workflows/build-image.yaml vendored Normal file
View file

@ -0,0 +1,52 @@
name: Build Docker image
on:
workflow_dispatch:
push:
branches: ['dev', 'prod']
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set environment variables
id: set_env_vars
run: |
if [ "${GITHUB_REF_NAME}" = "dev" ]; then
echo "SOC_ENV=${SOC_ENV_DEV}" >> $GITHUB_ENV
echo "DATABASE_URL=${SOC_MARIADB_URL_DEV}" >> $GITHUB_ENV
elif [ "${GITHUB_REF_NAME}" = "prod" ]; then
echo "SOC_ENV=${SOC_ENV_PROD}" >> $GITHUB_ENV
echo "DATABASE_URL=${SOC_MARIADB_URL_PROD}" >> $GITHUB_ENV
fi
- name: Prepare environment
run: |
echo "$GITHUB_ENV" > .env.runner
echo $(echo "$GITHUB_ENV" | sed 's#mariadb:3306#behemoth.cerberus-alligator.ts.net:3306#g') > .env.docker
ls -a
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
check-latest: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
push: false
tags: soc-site:${{ github.ref_name }}
- name: Tailscale
uses: tailscale/github-action@v3
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci

3
.gitignore vendored
View file

@ -21,8 +21,7 @@ yarn-error.log*
pnpm-debug.log*
# environment variables
.env
.env.production
# .env*
# macOS-specific files
.DS_Store

View file

@ -1,19 +1,31 @@
FROM node:24-alpine AS builder
FROM node:24-alpine AS build-deps
WORKDIR /app
RUN corepack enable
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
FROM node:24-alpine AS build
ARG GIT_BRANCH
WORKDIR /app
COPY . .
RUN yarn install --frozen-lockfile
COPY --from=build-deps /app/node_modules ./node_modules
COPY .env.docker .env
RUN yarn build
FROM node:24-alpine AS dependencies
FROM node:24-alpine AS prod-deps
WORKDIR /app
COPY package.json yarn.lock ./
RUN corepack enable
RUN yarn install --production --frozen-lockfile
FROM node:24-alpine AS runner
ARG GIT_BRANCH
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"]
COPY --from=build /app/dist ./dist
COPY --from=prod-deps /app/node_modules ./node_modules
COPY .env.runner .env
COPY package.json yarn.lock
CMD ["yarn prisma:migrate", "node ./dist/server/entry.mjs"]

View file

@ -4,9 +4,9 @@
"version": "1.0.0",
"scripts": {
"dev": "astro dev",
"build": "yarn run prisma:build && astro build",
"build": "yarn prisma:build && astro build",
"prisma:migrate": "prisma migrate deploy && tsx ./prisma/migrate.ts",
"prisma:build": "yarn prisma:migrate && prisma generate --sql"
"prisma:build": "prisma generate --sql"
},
"dependencies": {
"@ag-grid-community/locale": "^33.3.2",
@ -46,6 +46,7 @@
"@parcel/watcher": "^2.4.1",
"@types/nodemailer": "^6.4.17",
"concurrently": "^8.2.2",
"daisyui": "^5.0.43",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-astro": "^1.2.4",
@ -54,5 +55,5 @@
"prettier": "^3.3.3",
"prettier-config-standard": "^7.0.0"
},
"packageManager": "yarn@4.9.1"
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

17268
yarn.lock

File diff suppressed because it is too large Load diff