Skip to content

Commit

Permalink
Merge pull request #357 from neo4j/feature/reverse-proxy-multi-stage-…
Browse files Browse the repository at this point in the history
…build

Use docker multi-stage build for reverse-proxy image
  • Loading branch information
bfeshti authored Nov 10, 2024
2 parents 19fbd4c + 865c3f0 commit 7d44b8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions internal/integration_tests/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ func InstallReverseProxyHelmChart(t *testing.T, standaloneReleaseName model.Rele
assert.NotNil(t, pods, "no reverse proxy pods found")
assert.Equal(t, len(pods.Items), 1, "more than 1 reverse proxy pods found")

cmd := []string{"ls", "-lst", "/go"}
cmd := []string{"ls", "-lst", "/reverse-proxy"}
stdoutCmd, _, err := ExecInPod(standaloneReleaseName, cmd, pods.Items[0].Name)
assert.NoError(t, err, "cannot exec in reverse proxy pod")
assert.NotContains(t, stdoutCmd, "root")
Expand All @@ -1089,9 +1089,9 @@ func InstallReverseProxyHelmChart(t *testing.T, standaloneReleaseName model.Rele
assert.NotEmpty(t, ingressIP, "no ingress ip found")

ingressURL := fmt.Sprintf("https://%s:443", ingressIP)
stdout, _, err := RunCommand(exec.Command("curl", "-ivk", ingressURL))
stdout, _, err := RunCommand(exec.Command("wget", "-qO-", "--no-check-certificate", ingressURL))
assert.NoError(t, err)
assert.NotNil(t, string(stdout), "no curl output found")
assert.NotNil(t, string(stdout), "no wget output found")
assert.Contains(t, string(stdout), "bolt_routing")
assert.NotContains(t, string(stdout), "8443")

Expand Down
17 changes: 10 additions & 7 deletions neo4j-reverse-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
FROM golang:1.22-alpine
RUN apk --no-cache add curl \
&& addgroup --gid 7474 --system neo4j \
&& adduser --uid 7474 --system --no-create-home --home "/go" --ingroup neo4j neo4j
WORKDIR reverse-proxy
FROM golang:1.22-alpine AS build
WORKDIR /go/reverse-proxy
COPY reverse-proxy/operations operations/
COPY reverse-proxy/proxy proxy/
COPY reverse-proxy/go.mod go.mod
COPY reverse-proxy/main.go main.go
RUN go mod download && go mod verify \
&& go build -v -o reverseproxy_linux main.go \
&& chown -R neo4j:neo4j /go && chmod -R 777 /go
&& go build -v -o reverseproxy_linux main.go

FROM alpine:3.20.2 AS run
RUN addgroup --gid 7474 --system neo4j \
&& adduser --uid 7474 --system --no-create-home neo4j
WORKDIR /reverse-proxy
COPY --from=build --chown=neo4j:neo4j --chmod=777 /go/reverse-proxy/reverseproxy_linux reverseproxy_linux
USER neo4j
CMD ["./reverseproxy_linux"]

0 comments on commit 7d44b8e

Please sign in to comment.