Skip to content

Commit

Permalink
fix CI/startup issues and move to non-root container
Browse files Browse the repository at this point in the history
  • Loading branch information
pnickolov committed Feb 9, 2024
1 parent e763186 commit 22c0b4d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
with:
context: .
push: true
tags: ghcr.io/${{ github.repository_owner }}/image-name:${{ github.event.release.tag_name }}
tags: ghcr.io/${{ github.repository_owner }}/co-http:${{ github.event.release.tag_name }}
labels: |
org.opencontainers.image.title=co-http
org.opencontainers.image.description=Simple workload for testing performance and optimization
Expand Down
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ RUN CGO_ENABLED=0 go build -o co-http

FROM alpine:3.19.1

COPY --from=builder /src/co-http /src/startup.sh /
COPY --from=builder /src/co-http /src/startup.sh /home/nobody/

# Change the ownership of the copied files to nobody
RUN chown -R nobody:nogroup /home/nobody

# Switch to the nobody user
USER nobody
WORKDIR /home/nobody

ENV HTTP_ADDR=:8080

ENTRYPOINT ["/startup.sh"]
ENTRYPOINT ["/home/nobody/startup.sh"]
2 changes: 1 addition & 1 deletion startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ echo "OTEL_EXPORTER_OTLP_INSECURE=$OTEL_EXPORTER_OTLP_INSECURE"
echo "OTEL_RESOURCE_ATTRIBUTES=$OTEL_RESOURCE_ATTRIBUTES"
echo "OTEL_TRACES_EXPORTER=$OTEL_TRACES_EXPORTER"
echo "OTEL_SERVICE_NAME=$OTEL_SERVICE_NAME"
exec /co-http "$@"
exec ./co-http "$@"

0 comments on commit 22c0b4d

Please sign in to comment.