Skip to content

Commit

Permalink
Fix /tmp not writable (#3)
Browse files Browse the repository at this point in the history
* ci: specify bullseye for golang image

* fix(runj/execute): mount /tmp as tmpfs
This will make programs that need to write to temporary files happy.

* fix(runj/execute): make mount /tmp more secure
  • Loading branch information
chenjunyu19 authored Aug 17, 2023
1 parent f128c21 commit f66b65c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG GIT_SHA
ARG GIT_NAME

FROM golang:1.19 AS runj
FROM golang:1.19-bullseye AS runj
WORKDIR /usr/src/app/
COPY runj/go.mod runj/go.sum ./
RUN go mod download && go mod verify
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19 AS runj
FROM golang:1.19-bullseye AS runj
WORKDIR /usr/src/app/
COPY runj/go.mod runj/go.sum ./
RUN go mod download && go mod verify
Expand Down
6 changes: 6 additions & 0 deletions runj/cmd/runj/execute/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ var defaultMountPoints = []specs.Mount{
Source: "sysfs",
Options: []string{"nosuid", "noexec", "nodev", "ro"},
},
{
Destination: "/tmp",
Type: "tmpfs",
Source: "tmpfs",
Options: []string{"nosuid", "noexec", "nodev", "size=128m", "nr_inodes=4k"},
},
}

func makeContainerSpec(config *entities.RunjConfig, uidMappings []specs.LinuxIDMapping, gidMappings []specs.LinuxIDMapping) (*specs.Spec, error) {
Expand Down

0 comments on commit f66b65c

Please sign in to comment.