Skip to content

Commit c013f76

Browse files
nix -> Dockerfile
1 parent b1622b3 commit c013f76

File tree

3 files changed

+12
-24
lines changed

3 files changed

+12
-24
lines changed

.github/workflows/build-and-deploy.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ jobs:
1515
fetch-depth: 0
1616
- uses: DeterminateSystems/nix-installer-action@main
1717
- uses: DeterminateSystems/flakehub-cache-action@main
18-
- name: Build and load image
19-
run: docker load <$(nix build --extra-experimental-features "nix-command flakes" --print-out-paths --no-link .#packages.x86_64-linux.docker)
18+
- name: Build binary
19+
run: nix build --extra-experimental-features "nix-command flakes" .#packages.x86_64-linux.webdavplugin
20+
- name: Build docker image
21+
run: docker build -t $IMAGE_NAME .
2022
- name: Log in to registry
2123
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
2224
- name: Push image

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM debian:bullseye
2+
3+
ARG binary=./result/bin/webdav
4+
COPY ${binary} /webdav
5+
6+
RUN apt update && apt install -y davfs2
7+
8+
ENTRYPOINT ["/webdav"]

flake.nix

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,6 @@
2828
webdavplugin = callPackage ./. {
2929
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
3030
};
31-
32-
docker = pkgs.dockerTools.buildImage {
33-
name = "webdavplugin";
34-
tag = "latest";
35-
contents = pkgs.buildEnv {
36-
name = "image-root";
37-
paths = with pkgs; [
38-
mount
39-
davfs2
40-
];
41-
};
42-
# https://nixos.org/manual/nixpkgs/stable/#ssec-pkgs-dockerTools-shadowSetup
43-
runAsRoot = ''
44-
${pkgs.dockerTools.shadowSetup}
45-
groupadd -r davfs2
46-
useradd -r -g davfs2 davfs2
47-
ln -s /proc/mounts /etc/mtab # davfs2 needs this
48-
mkdir -p /var/cache/davfs2
49-
chmod 0600 /etc/davfs2/secrets # reset permissions
50-
'';
51-
config.Entrypoint = ["${webdavplugin}/bin/webdav"];
52-
};
5331
};
5432
devShells.default = callPackage ./shell.nix {
5533
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix;

0 commit comments

Comments
 (0)