Skip to content

Commit 770a48a

Browse files
committed
BE: Build Docker cnt in GH action
1 parent 416a9b4 commit 770a48a

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Build docker image
2+
3+
on:
4+
push:
5+
pull_request:
6+
jobs:
7+
tests:
8+
defaults:
9+
run:
10+
working-directory: backend
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- run: docker build - < projectify-backend.Dockerfile

backend/projectify-backend.Dockerfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM nixos/nix:24.05 as builder
2+
3+
WORKDIR /app
4+
COPY . .
5+
6+
RUN echo "experimental-features = nix-command flakes" > /etc/nix/nix.conf
7+
8+
RUN nix build .#projectify-backend
9+
# https://marcopolo.io/code/nix-and-small-containers/
10+
# https://mitchellh.com/writing/nix-with-dockerfiles
11+
RUN cp -a $(nix-store -qR result/) /tmp/nix-store-closure
12+
13+
FROM scratch
14+
WORKDIR /app
15+
COPY --from=builder /tmp/nix-store-closure /nix/store
16+
COPY --from=builder /app/result /app

0 commit comments

Comments
 (0)