Skip to content

Commit eaea7ca

Browse files
committed
Files to fix the merge
1 parent 7d55b3c commit eaea7ca

File tree

3 files changed

+117
-0
lines changed

3 files changed

+117
-0
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ registries:
66
username: "${{secrets.DEPENDABOT_USER}}"
77
password: "${{secrets.DEPENDABOT_PASS}}"
88
updates:
9+
- package-ecosystem: "gomod"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
open-pull-requests-limit: 10
14+
- package-ecosystem: "github-actions"
15+
directory: "/"
16+
schedule:
17+
interval: "weekly"
18+
open-pull-requests-limit: 10
919
- package-ecosystem: "docker"
1020
directory: "/"
1121
schedule:
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: "Code scanning - action"
2+
3+
on:
4+
push:
5+
branches: [master, ]
6+
pull_request:
7+
schedule:
8+
- cron: '0 15 * * 5'
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
CodeQL-Build:
15+
16+
permissions:
17+
actions: read # for github/codeql-action/init to get workflow details
18+
contents: read # for actions/checkout to fetch code
19+
security-events: write # for github/codeql-action/autobuild to send a status report
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
25+
with:
26+
# We must fetch at least the immediate parents so that if this is
27+
# a pull request then we can checkout the head.
28+
fetch-depth: 2
29+
30+
# If this run was triggered by a pull request event, then checkout
31+
# the head of the pull request instead of the merge commit.
32+
- run: git checkout HEAD^2
33+
if: ${{ github.event_name == 'pull_request' }}
34+
35+
# Initializes the CodeQL tools for scanning.
36+
- name: Initialize CodeQL
37+
uses: github/codeql-action/init@41a4ada31ba866a7f1196b9602703a89edd69e22 # tag=v2
38+
# Override language selection by uncommenting this and choosing your languages
39+
# with:
40+
# languages: go, javascript, csharp, python, cpp, java
41+
42+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
43+
# If this step fails, then you should remove it and run the build manually (see below)
44+
- name: Autobuild
45+
uses: github/codeql-action/autobuild@41a4ada31ba866a7f1196b9602703a89edd69e22 # tag=v2
46+
47+
# ℹ️ Command-line programs to run using the OS shell.
48+
# 📚 https://git.io/JvXDl
49+
50+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
51+
# and modify them (or add more) to build your code if your project
52+
# uses a compiled language
53+
54+
#- run: |
55+
# make bootstrap
56+
# make release
57+
58+
- name: Perform CodeQL Analysis
59+
uses: github/codeql-action/analyze@41a4ada31ba866a7f1196b9602703a89edd69e22 # tag=v2

docker/Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
ARG GOARCH
2+
#
3+
# build container
4+
#
5+
FROM --platform=linux/amd64 golang:1.18-alpine as builder
6+
WORKDIR /go/src/github.com/oliver006/redis_exporter/
7+
8+
ADD . /go/src/github.com/oliver006/redis_exporter/
9+
10+
ARG SHA1="[no-sha]"
11+
ARG TAG="[no-tag]"
12+
ARG GOARCH
13+
14+
RUN apk --no-cache add ca-certificates git
15+
RUN BUILD_DATE=$(date +%F-%T) CGO_ENABLED=0 GOOS=linux GOARCH=$GOARCH go build -o /redis_exporter \
16+
-ldflags "-s -w -extldflags \"-static\" -X main.BuildVersion=$TAG -X main.BuildCommitSha=$SHA1 -X main.BuildDate=$BUILD_DATE" .
17+
18+
RUN [ "$GOARCH" = "amd64" ] && /redis_exporter -version || ls -la /redis_exporter
19+
20+
#
21+
# scratch release container
22+
#
23+
FROM --platform=linux/$GOARCH scratch as scratch
24+
25+
COPY --from=builder /redis_exporter /redis_exporter
26+
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
27+
COPY --from=builder /etc/nsswitch.conf /etc/nsswitch.conf
28+
29+
# Run as non-root user for secure environments
30+
USER 59000:59000
31+
32+
EXPOSE 9121
33+
ENTRYPOINT [ "/redis_exporter" ]
34+
35+
36+
#
37+
# Alpine release container
38+
#
39+
FROM --platform=linux/$GOARCH alpine as alpine
40+
41+
COPY --from=builder /redis_exporter /redis_exporter
42+
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
43+
44+
# Run as non-root user for secure environments
45+
USER 59000:59000
46+
47+
EXPOSE 9121
48+
ENTRYPOINT [ "/redis_exporter" ]

0 commit comments

Comments
 (0)