Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring Dockerfiles #153

Merged
merged 1 commit into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions build/go/fileshot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
FROM golang AS build
LABEL maintainer "Target Brands, Inc. [email protected]"
LABEL maintainer="Target Brands, Inc. [email protected]"

# Copy source files and set the working directory
COPY ./src/go/ /go/src/github.com/target/strelka/src/go/
RUN cd /go/src/github.com/target/strelka/src/go/cmd/strelka-fileshot/ && \
go get . && \
WORKDIR /go/src/github.com/target/strelka/src/go/

# Initialize, get, and build go modules and main package
RUN go mod init && \
go mod tidy && \
cd /go/src/github.com/target/strelka/src/go/cmd/strelka-fileshot/ && \
CGO_ENABLED=0 go build -o /tmp/strelka-fileshot .

# Move build and initialize non-root user
FROM alpine
COPY --from=build /tmp/strelka-fileshot /usr/local/bin/strelka-fileshot
RUN apk add --no-cache jq
Expand Down
12 changes: 9 additions & 3 deletions build/go/filestream/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
FROM golang AS build
LABEL maintainer "Target Brands, Inc. [email protected]"
LABEL maintainer="Target Brands, Inc. [email protected]"

# Copy source files and set the working directory
COPY ./src/go/ /go/src/github.com/target/strelka/src/go/
RUN cd /go/src/github.com/target/strelka/src/go/cmd/strelka-filestream/ && \
go get . && \
WORKDIR /go/src/github.com/target/strelka/src/go/

# Initialize, get, and build go modules and main package
RUN go mod init && \
go mod tidy && \
cd /go/src/github.com/target/strelka/src/go/cmd/strelka-filestream/ && \
CGO_ENABLED=0 go build -o /tmp/strelka-filestream .

# Move build, install additional packages, and initialize non-root user
FROM alpine
COPY --from=build /tmp/strelka-filestream /usr/local/bin/strelka-filestream
RUN apk add --no-cache jq
Expand Down
13 changes: 8 additions & 5 deletions build/go/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
FROM golang AS build
LABEL maintainer "Target Brands, Inc. [email protected]"

ENV GO111MODULE=on
LABEL maintainer="Target Brands, Inc. [email protected]"

# Copy source files and set the working directory
COPY ./src/go/ /go/src/github.com/target/strelka/src/go/
WORKDIR /go/src/github.com/target/strelka/src/go/

RUN go mod init && cd /go/src/github.com/target/strelka/src/go/cmd/strelka-frontend/ && \
CGO_ENABLED=0 go build -o /tmp/strelka-frontend .
# Initialize, get, and build go modules and main package
RUN go mod init && \
go mod tidy && \
cd /go/src/github.com/target/strelka/src/go/cmd/strelka-frontend/ && \
CGO_ENABLED=0 go build -o /tmp/strelka-frontend .

# Move build, create default logging directory, and initialize non-root user
FROM alpine
COPY --from=build /tmp/strelka-frontend /usr/local/bin/strelka-frontend
RUN mkdir /var/log/strelka/ && \
Expand Down
13 changes: 8 additions & 5 deletions build/go/manager/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
FROM golang AS build
LABEL maintainer "Target Brands, Inc. [email protected]"

ENV GO111MODULE=on
LABEL maintainer="Target Brands, Inc. [email protected]"

# Copy source files and set the working directory
COPY ./src/go/ /go/src/github.com/target/strelka/src/go/
WORKDIR /go/src/github.com/target/strelka/src/go/

RUN go mod init && cd /go/src/github.com/target/strelka/src/go/cmd/strelka-manager/ && \
CGO_ENABLED=0 go build -o /tmp/strelka-manager .
# Initialize, get, and build go modules and main package
RUN go mod init && \
go mod tidy && \
cd /go/src/github.com/target/strelka/src/go/cmd/strelka-manager/ && \
CGO_ENABLED=0 go build -o /tmp/strelka-manager .

# Move build and initialize non-root user
FROM alpine
COPY --from=build /tmp/strelka-manager /usr/local/bin/strelka-manager
USER 1001
2 changes: 1 addition & 1 deletion build/python/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
LABEL maintainer "Target Brands, Inc. [email protected]"
LABEL maintainer="Target Brands, Inc. [email protected]"

ARG YARA_VERSION=3.11.0
ARG YARA_PYTHON_VERSION=3.11.0
Expand Down
2 changes: 1 addition & 1 deletion build/python/mmrpc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
LABEL maintainer "Target Brands, Inc. [email protected]"
LABEL maintainer="Target Brands, Inc. [email protected]"

# Copy Strelka files
COPY ./src/python/ /strelka/
Expand Down