Skip to content

Commit

Permalink
BE: Build Docker cnt in GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
justuswilhelm committed Jul 8, 2024
1 parent 416a9b4 commit 4fb5cf5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build-projectify-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Build docker image

on:
push:
pull_request:
jobs:
tests:
defaults:
run:
working-directory: backend
runs-on: ubuntu-latest
steps:
- uses: actions@checkout@v4
- run: docker build - < projectify-backend.Dockerfile
16 changes: 16 additions & 0 deletions backend/projectify-backend.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM nixos/nix:24.05 as builder

WORKDIR /app
COPY . .

RUN echo "experimental-features = nix-command flakes" > /etc/nix/nix.conf

RUN nix build .#projectify-backend
# https://marcopolo.io/code/nix-and-small-containers/
# https://mitchellh.com/writing/nix-with-dockerfiles
RUN cp -a $(nix-store -qR result/) /tmp/nix-store-closure

FROM scratch
WORKDIR /app
COPY --from=builder /tmp/nix-store-closure /nix/store
COPY --from=builder /app/result /app

0 comments on commit 4fb5cf5

Please sign in to comment.