2019-10-07 03:18:06 +00:00
|
|
|
# Minify client side assets (JavaScript)
|
|
|
|
FROM node:latest AS build-js
|
2019-04-26 01:19:18 +00:00
|
|
|
|
2019-10-07 03:18:06 +00:00
|
|
|
RUN npm install gulp gulp-cli -g
|
|
|
|
|
|
|
|
WORKDIR /build
|
2019-04-26 01:19:18 +00:00
|
|
|
COPY . .
|
2019-10-07 03:18:06 +00:00
|
|
|
RUN npm install --only=dev
|
|
|
|
RUN gulp
|
2019-04-26 01:19:18 +00:00
|
|
|
|
|
|
|
|
2019-10-07 03:18:06 +00:00
|
|
|
# Build Golang binary
|
2021-01-24 19:44:10 +00:00
|
|
|
FROM golang:1.15.2 AS build-golang
|
2019-04-26 01:19:18 +00:00
|
|
|
|
2019-10-07 03:18:06 +00:00
|
|
|
WORKDIR /go/src/github.com/gophish/gophish
|
|
|
|
COPY . .
|
|
|
|
RUN go get -v && go build -v
|
2019-04-26 01:19:18 +00:00
|
|
|
|
|
|
|
|
2019-10-07 03:18:06 +00:00
|
|
|
# Runtime container
|
|
|
|
FROM debian:stable-slim
|
|
|
|
|
|
|
|
RUN useradd -m -d /opt/gophish -s /bin/bash app
|
|
|
|
|
|
|
|
RUN apt-get update && \
|
2019-11-24 03:28:28 +00:00
|
|
|
apt-get install --no-install-recommends -y jq libcap2-bin && \
|
2019-10-07 03:18:06 +00:00
|
|
|
apt-get clean && \
|
|
|
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
|
|
|
|
WORKDIR /opt/gophish
|
|
|
|
COPY --from=build-golang /go/src/github.com/gophish/gophish/ ./
|
|
|
|
COPY --from=build-js /build/static/js/dist/ ./static/js/dist/
|
|
|
|
COPY --from=build-js /build/static/css/dist/ ./static/css/dist/
|
|
|
|
COPY --from=build-golang /go/src/github.com/gophish/gophish/config.json ./
|
|
|
|
RUN chown app. config.json
|
|
|
|
|
2019-11-24 03:28:28 +00:00
|
|
|
RUN setcap 'cap_net_bind_service=+ep' /opt/gophish/gophish
|
|
|
|
|
2019-10-07 03:18:06 +00:00
|
|
|
USER app
|
2019-04-26 01:19:18 +00:00
|
|
|
RUN sed -i 's/127.0.0.1/0.0.0.0/g' config.json
|
2023-03-30 18:15:21 +00:00
|
|
|
RUN sed -i 's/"gophish.db"/"data\/gophish.db"/g' config.json
|
2019-10-07 03:18:06 +00:00
|
|
|
RUN touch config.json.tmp
|
2023-03-30 18:15:21 +00:00
|
|
|
RUN mkdir data
|
2019-04-26 01:19:18 +00:00
|
|
|
|
2021-01-24 19:44:10 +00:00
|
|
|
EXPOSE 3333 8080 8443 80
|
2019-04-26 01:19:18 +00:00
|
|
|
|
|
|
|
CMD ["./docker/run.sh"]
|