Skip to content

Commit 5f8adf8

Browse files
authored
Merge pull request #48 from 117503445/dev
build(go): 升级 Go 版本至 1.25.1
2 parents 6a92e68 + 1d5d958 commit 5f8adf8

File tree

5 files changed

+31
-28
lines changed

5 files changed

+31
-28
lines changed

.github/workflows/docker.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,30 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12+
# https://github.com/actions/checkout
1213
- name: Checkout
13-
uses: actions/checkout@v2
14+
uses: actions/checkout@v5
1415

1516
# https://github.com/docker/setup-qemu-action
1617
- name: Set up QEMU
17-
uses: docker/setup-qemu-action@v1
18+
uses: docker/setup-qemu-action@v3
1819

1920
# https://github.com/docker/setup-buildx-action
2021
- name: Set up Docker Buildx
2122
id: buildx
22-
uses: docker/setup-buildx-action@v1
23+
uses: docker/setup-buildx-action@v3
2324

25+
# https://github.com/docker/login-action
2426
- name: Login to DockerHub
25-
uses: docker/login-action@v1
27+
uses: docker/login-action@v3
2628
with:
2729
username: ${{ secrets.DOCKERHUB_USERNAME }}
2830
password: ${{ secrets.DOCKERHUB_TOKEN }}
2931

3032
# https://github.com/docker/metadata-action
3133
- name: Docker meta
3234
id: meta
33-
uses: docker/metadata-action@v3
35+
uses: docker/metadata-action@v5
3436
with:
3537
images: |
3638
117503445/go_webdav
@@ -46,7 +48,7 @@ jobs:
4648
4749
# https://github.com/docker/build-push-action
4850
- name: Build and push
49-
uses: docker/build-push-action@v2
51+
uses: docker/build-push-action@v6
5052
with:
5153
context: .
5254
platforms: linux/amd64,linux/arm64

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
# https://github.com/actions/setup-go
1515
- uses: actions/setup-go@v4
1616
with:
17-
go-version: "1.23"
17+
go-version: "1.25"
1818

1919
- run: CGO_ENABLED=0 go test ./...
2020

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23 AS build
1+
FROM golang:1.25.1 AS build
22
ARG GOPROXY=https://proxy.golang.org,direct
33
WORKDIR /workspace
44
COPY go.mod go.sum ./

doc/nonroot.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
11
# nonroot
22

3-
If you want to use Gowebdav with Docker under a non-root user, you can follow these steps.
3+
If you wish to run Gowebdav in Docker under a non-root user environment, please follow the steps below.
44

55
## Steps
66

7-
Using Docker Compose as an example, let's say you want to share `./data/dir1` and `./data/dir2` directories. First, prepare a `docker-compose.yml` file:
7+
Taking Docker Compose as an example, suppose you want to share two directories: `./data/dir1` and `./data/dir2`. First, prepare your directories:
8+
9+
```bash
10+
mkdir -p ./data # This is just an example; you can create directories in any way you prefer
11+
```
12+
13+
Next, obtain the UID and GID of the directory:
14+
15+
```bash
16+
ls -nd ./data | awk '{ print $3":"$4 }'
17+
```
18+
19+
Then, create a `docker-compose.yml` file:
820

921
```yaml
1022
services:
1123
go_webdav:
1224
image: 117503445/go_webdav
1325
restart: unless-stopped
1426
volumes:
15-
- ./data:/home/nonroot
27+
- ./data:/data
1628
environment:
17-
- "dav=/dir1,/home/nonroot/dir1,null,null,false;/dir2,/home/nonroot/dir2,null,null,false"
29+
- "dav=/dir1,/data/dir1,null,null,false;/dir2,/data/dir2,null,null,false"
1830
ports:
1931
- "80:80"
20-
user: "nonroot" # Specify the user inside the container as nonroot
21-
```
22-
23-
Next, create the directories and set the permissions to 777:
24-
25-
```bash
26-
mkdir -p ./data/dir1 ./data/dir2
27-
chmod 777 ./data/dir1 ./data/dir2
32+
user: "1000:1000" # Replace with the correct UID and GID to ensure execution under the proper user
2833
```
2934
3035
Finally, start the container:
@@ -35,10 +40,6 @@ docker compose up -d
3540

3641
## Notes
3742

38-
`117503445/go_webdav` is based on [gcr.io/distroless/static-debian12](https://github.com/GoogleContainerTools/distroless). The `nonroot` user inside the image is a non-root user with a UID of 65532 and has write permissions to the `/home/nonroot` directory.
39-
40-
- If you do not create the `data` directory in advance, it will be automatically created when the container starts. However, this will be done by the Docker Daemon with root privileges, which may lead to permission issues.
41-
- If you do not create the `dir1` and `dir2` directories in advance, they will be created by `GoWebdav` when the container starts. Since these directories will belong to the `nonroot` user, external regular users will not be able to write to them.
42-
- If you do not set the permissions to 777 in advance, the `nonroot` user in `GoWebdav` will not be able to write to these directories.
43-
44-
In the scenarios described above, both inside and outside the container are regular users. If you only require the container to run as a regular user and the host to run as root, or vice versa, the setup might be simpler.
43+
Docker supports specifying a user via the `--user "UID:GID"` option, allowing you to run containers as a non-root user.
44+
However, you must create the `data` directory in advance to prevent the Docker daemon from creating it with root permissions, which could lead to permission issues.
45+
In the scenario above, both inside and outside the container use a regular (non-root) user. If you only require the container to run as a regular user while the host uses root (or vice versa), the setup might be simpler.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/117503445/GoWebDAV
22

3-
go 1.23.4
3+
go 1.25.1
44

55
require (
66
github.com/117503445/goutils v0.0.0-20240817175023-c208c6d669ae

0 commit comments

Comments
 (0)