Skip to content

Commit b4a5b9c

Browse files
authored
Docker hardening + SBOMs and provenance (#1065)
1 parent 0b8b853 commit b4a5b9c

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

.github/workflows/push-docker.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ jobs:
6363
with:
6464
push: true
6565
file: docker/Dockerfile
66+
provenance: mode=max
67+
sbom: true
6668
tags: |
6769
surrealdb/surrealist:latest
6870
surrealdb/surrealist:${{ needs.version.outputs.version }}

.github/workflows/push-release.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ jobs:
6868
platforms: linux/amd64,linux/arm64
6969
push: true
7070
file: docker/Dockerfile
71+
provenance: mode=max
72+
sbom: true
7173
tags: |
7274
surrealdb/surrealist:latest
7375
surrealdb/surrealist:${{ needs.version.outputs.version }}

docker/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ RUN mkdir html
2424
WORKDIR /
2525

2626
RUN rm /etc/nginx/conf.d/default.conf
27+
RUN addgroup -S surrealist && adduser -S -D -H -s /sbin/nologin -G surrealist surrealist
28+
RUN mkdir -p /var/cache/nginx /var/run/nginx /var/log/nginx \
29+
&& chown -R surrealist:surrealist /var/cache/nginx /var/run/nginx /var/log/nginx
2730

2831
COPY --from=builder /app/dist /usr/share/nginx/html
2932
COPY ./docker/nginx/nginx.conf /etc/nginx
33+
RUN chown -R surrealist:surrealist /usr/share/nginx/html /etc/nginx
34+
35+
USER surrealist
3036

3137
EXPOSE 8080
32-
CMD ["nginx", "-g", "daemon off;"]
38+
CMD ["nginx", "-g", "daemon off;"]

docker/nginx/nginx.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
user nginx;
1+
pid /var/run/nginx/nginx.pid;
22

33
worker_processes auto;
44

@@ -63,4 +63,4 @@ http {
6363
gzip_static on;
6464
gunzip on;
6565
}
66-
}
66+
}

0 commit comments

Comments
 (0)