What
All checks were successful
Docker Deploy / build-and-push (push) Successful in 3m21s

This commit is contained in:
2025-12-22 15:25:02 -07:00
parent ecfc163255
commit a7d8510f93
5 changed files with 15 additions and 170 deletions

View File

@@ -1,10 +1,9 @@
name: Build and Deploy
name: Docker Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-push:
runs-on: ubuntu-latest
@@ -13,30 +12,24 @@ jobs:
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
experimental-features = nix-command flakes
- name: Build container image
run: |
nix build --impure --print-build-logs
docker load < result
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Container Registry
uses: docker/login-action@v3
uses: docker/login-action@v2
with:
registry: ${{ secrets.REPO_HOST }}
username: ${{ github.repository_owner }}
password: ${{ secrets.DEPLOY_TOKEN }}
- name: Tag and push images
run: |
docker tag atashdotdev:latest ${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}
docker tag atashdotdev:latest ${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
docker push ${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}
docker push ${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: true
tags: |
${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}
${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest

View File

@@ -1,5 +1,3 @@
# Atash Website
This project requires Nix with Flakes enabled.
Run ```nix develop``` in order to install dependencies. Then, use pnpm as normal.
:)

61
flake.lock generated
View File

@@ -1,61 +0,0 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1753250450,
"narHash": "sha256-i+CQV2rPmP8wHxj0aq4siYyohHwVlsh40kV89f3nw1s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "fc02ee70efb805d3b2865908a13ddd4474557ecf",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@@ -1,84 +0,0 @@
{
description = "Development environment for atashdotdev with Node and pnpm";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
version = (pkgs.lib.importJSON ./package.json).version;
app = pkgs.stdenv.mkDerivation {
pname = "atashdotdev";
inherit version;
src = ./.;
nativeBuildInputs = with pkgs; [ nodejs_24 nodePackages.pnpm cacert ];
buildPhase = ''
export HOME=$TMPDIR
export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt
pnpm install --frozen-lockfile
pnpm build
'';
installPhase = ''
mkdir -p $out/lib/app
cp -r dist package.json pnpm-lock.yaml $out/lib/app/
cd $out/lib/app && pnpm install --prod --frozen-lockfile
mkdir -p $out/bin
echo '#!/bin/sh
cd $out/lib/app
exec ${pkgs.nodejs_24}/bin/node ./dist/server/entry.mjs "$@"' > $out/bin/atashdotdev
chmod +x $out/bin/atashdotdev
'';
};
in
{
# Dev shell
devShells.default = pkgs.mkShell {
packages = with pkgs; [ nodejs_24 nodePackages.pnpm ];
shellHook = ''
echo "🚀 atashdotdev development environment loaded!"
echo "Node version: $(node --version)"
echo "pnpm version: $(pnpm --version)"
if [ ! -d "node_modules" ]; then
echo "📦 Installing pnpm dependencies..."
pnpm install --frozen-lockfile
fi
'';
};
# nix run - run the dev server
apps.default = {
type = "app";
program = "${pkgs.writeShellScript "dev" ''
export PATH="${pkgs.nodejs_24}/bin:${pkgs.nodePackages.pnpm}/bin:$PATH"
if [ ! -d "node_modules" ]; then
pnpm install --frozen-lockfile
fi
pnpm dev
''}";
};
# nix build - build the container
packages.default = pkgs.dockerTools.buildLayeredImage {
name = "atashdotdev";
tag = "latest";
contents = with pkgs; [ app nodejs_24 bash coreutils ];
config = {
Cmd = [ "${app}/bin/atashdotdev" ];
ExposedPorts."4321/tcp" = {};
Env = [ "NODE_ENV=production" "HOST=0.0.0.0" "PORT=4321" ];
WorkingDir = "${app}/lib/app";
};
};
});
}

View File

@@ -6,7 +6,6 @@
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"nix:run": "nix develop",
"astro": "astro"
},
"dependencies": {