Skip to content

Commit

Permalink
Add CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
xZero707 committed Apr 2, 2023
1 parent cf8632d commit 5c60ec8
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 9 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
assignees:
- "xZero707"

# Maintain Docker image dependencies
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
assignees:
- "xZero707"
38 changes: 38 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build docker image

on:
push:
branches: master

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: checkout code
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
config-inline: |
[worker.oci]
max-parallelism = 16
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and push
uses: docker/[email protected]
with:
files: build/docker-bake.hcl
push: true
set: |
*.cache-from=type=gha,scope=docker-nfs-server
*.cache-to=type=gha,scope=docker-nfs-server,mode=max
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ EXPOSE 2049
# setup entrypoint
COPY ./entrypoint.sh /usr/local/bin
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

LABEL maintainer="Aleksandar Puharic <[email protected]>"
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ This is the only containerized NFS server that offers **all** of the following f

### Starting the server

Starting the `erichough/nfs-server` image will launch an NFS server. You'll need to supply some information upon container startup, which we'll cover below, but briefly speaking your `docker run` command might look something like this:
Starting the `nlss/nfs-server` image will launch an NFS server. You'll need to supply some information upon container startup, which we'll cover below, but briefly speaking your `docker run` command might look something like this:

docker run \
-v /host/path/to/shared/files:/some/container/path \
-v /host/path/to/exports.txt:/etc/exports:ro \
--cap-add SYS_ADMIN \
-p 2049:2049 \
erichough/nfs-server
nlss/nfs-server

Let's break that command down into its individual pieces to see what's required for a successful server startup.

Expand All @@ -86,7 +86,7 @@ Let's break that command down into its individual pieces to see what's required
docker run \
-v /host/path/to/exports.txt:/etc/exports:ro \
... \
erichough/nfs-server
nlss/nfs-server

1. provide each line of `/etc/exports` as an environment variable

Expand All @@ -96,26 +96,26 @@ Let's break that command down into its individual pieces to see what's required
-e NFS_EXPORT_0='/container/path/foo *(ro,no_subtree_check)' \
-e NFS_EXPORT_1='/container/path/bar 123.123.123.123/32(rw,no_subtree_check)' \
... \
erichough/nfs-server
nlss/nfs-server

1. bake `/etc/exports` into a custom image

e.g. in a `Dockerfile`:

```Dockerfile
FROM erichough/nfs-server
FROM nlss/nfs-server
ADD /host/path/to/exports.txt /etc/exports
```

1. **Use `--cap-add SYS_ADMIN` or `--privileged`**

As noted in the [requirements](#requirements), the container will need additional privileges. So your `run` command will need *either*:

docker run --cap-add SYS_ADMIN ... erichough/nfs-server
docker run --cap-add SYS_ADMIN ... nlss/nfs-server

or

docker run --privileged ... erichough/nfs-server
docker run --privileged ... nlss/nfs-server

Not sure which to use? Go for `--cap-add SYS_ADMIN` as it's the lesser of two evils.
Expand All @@ -125,7 +125,7 @@ Let's break that command down into its individual pieces to see what's required

* If your clients connect via **NFSv4 only**, you can get by with just TCP port `2049`:

docker run -p 2049:2049 ... erichough/nfs-server
docker run -p 2049:2049 ... nlss/nfs-server

* If you'd like to support **NFSv3**, you'll need to expose a lot more ports:

Expand All @@ -135,7 +135,7 @@ Let's break that command down into its individual pieces to see what's required
-p 32765:32765 -p 32765:32765/udp \
-p 32767:32767 -p 32767:32767/udp \
... \
erichough/nfs-server
nlss/nfs-server

If you pay close attention to each of the items in this section, the server should start quickly and be ready to accept your NFS clients.

Expand Down
20 changes: 20 additions & 0 deletions build/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
group "default" {
targets = ["latest"]
}

target "build-dockerfile" {
dockerfile = "Dockerfile"
}

target "build-platforms" {
platforms = ["linux/amd64", "linux/armhf", "linux/aarch64"]
}

target "build-common" {
pull = true
}

target "latest" {
inherits = ["build-dockerfile", "build-platforms", "build-common"]
tags = ["docker.io/nlss/nfs-server:latest"]
}

0 comments on commit 5c60ec8

Please sign in to comment.