Skip to content

Commit d96a7ac

Browse files
authored
Add docker deploys (BC-SECURITY#25)
* Create dockerimage.yml * Rename dockerimage.yml to .github/.workflow/dockerimage.yml * Rename .github/.workflow/dockerimage.yml to .github/workflows/dockerimage.yml * Update dockerimage.yml * Update dockerimage.yml * Update dockerimage.yml * Update dockerimage.yml * runs in -it mode, need to get cmd sorted out * Update dockerimage.yml add tag_names and trigger on release. * empty commit to trigger build * little bit of cleanup * readme * Update README.md * remove docker-action branch from dockerimage.yml
1 parent 972429c commit d96a7ac

File tree

5 files changed

+67
-40
lines changed

5 files changed

+67
-40
lines changed

.dockerignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ develop-eggs/
3131
dist/
3232
downloads/
3333
eggs/
34-
lib/
34+
# lib/
3535
lib64/
3636
parts/
3737
sdist/

.github/workflows/dockerimage.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- dev
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Publish Docker
17+
uses: elgohr/[email protected]
18+
with:
19+
name: bcsecurity/empire
20+
username: ${{ secrets.DOCKER_USERNAME }}
21+
password: ${{ secrets.DOCKER_PASSWORD }}
22+
dockerfile: Dockerfile
23+
tag_names: true

Dockerfile

+22-39
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,23 @@
11
# NOTE: Only use this when you want to build image locally
2-
# else use `docker pull empireproject/empire:{VERSION}`
3-
# all image versions can be found at: https://hub.docker.com/r/empireproject/empire/
2+
# else use `docker pull bcsecurity/empire:{VERSION}`
3+
# all image versions can be found at: https://hub.docker.com/r/bcsecurity/empire/
44

55
# -----BUILD COMMANDS----
6-
# 1) build command: `docker build -t empireproject/empire .`
7-
# 2) create volume storage: `docker create -v /opt/Empire --name data empireproject/empire`
8-
# 3) run out container: `docker run -ti --volumes-from data empireproject/empire /bin/bash`
6+
# 1) build command: `docker build -t bcsecurity/empire .`
7+
# 2) create volume storage: `docker create -v /empire --name data bcsecurity/empire`
8+
# 3) run out container: `docker run -ti --volumes-from data bcsecurity/empire /bin/bash`
99

1010
# -----RELEASE COMMANDS----
11-
# 1) `USERNAME=empireproject`
12-
# 2) `IMAGE=empire`
13-
# 3) `git pull`
14-
# 4) `export VERSION="$(curl -s https://raw.githubusercontent.com/EmpireProject/Empire/master/lib/common/empire.py | grep "VERSION =" | cut -d '"' -f2)"`
15-
# 5) `docker tag $USERNAME/$IMAGE:latest $USERNAME/$IMAGE:$VERSION`
16-
# 1) `docker push $USERNAME/$IMAGE:latest`
17-
# 2) `docker push $USERNAME/$IMAGE:$VERSION`
11+
# Handled by GitHub Actions
1812

1913
# -----BUILD ENTRY-----
2014

2115
# image base
22-
FROM ubuntu:16.04
23-
24-
# pull from BUILD
25-
ARG empirversion
16+
FROM python:3.7.5-buster
2617

2718
# extra metadata
28-
LABEL maintainer="EmpireProject"
19+
LABEL maintainer="bc-security"
2920
LABEL description="Dockerfile base for Empire server."
30-
LABEL version=${empirversion}
3121

3222
# env setup
3323
ENV STAGING_KEY=RANDOM
@@ -36,25 +26,18 @@ ENV DEBIAN_FRONTEND=noninteractive
3626
# set the def shell for ENV
3727
SHELL ["/bin/bash", "-c"]
3828

39-
# install basic build items
40-
RUN apt-get update && apt-get install -qy \
41-
wget \
42-
curl \
43-
git \
44-
sudo \
45-
apt-utils \
46-
lsb-core \
47-
python2.7 \
48-
python-dev \
49-
&& ln -sf /usr/bin/python2.7 /usr/bin/python \
50-
&& rm -rf /var/lib/apt/lists/*
51-
52-
# build empire from source
53-
# TODO: When we merge to master set branch to master
54-
RUN git clone --depth=1 -b dev https://github.com/EmpireProject/Empire.git /opt/Empire && \
55-
cd /opt/Empire/setup/ && \
29+
COPY . /empire
30+
31+
RUN apt-get update && \
32+
apt-get -y install sudo && \
33+
apt-get -y install lsb-release
34+
35+
RUN cd /empire/setup/ && \
5636
./install.sh && \
57-
rm -rf /opt/Empire/data/empire*
58-
RUN python2.7 /opt/Empire/setup/setup_database.py
59-
WORKDIR "/opt/Empire"
60-
CMD ["python2.7", "empire"]
37+
rm -rf /empire/data/empire*
38+
39+
RUN python /empire/setup/setup_database.py
40+
41+
WORKDIR /empire
42+
43+
CMD ["python", "empire"]

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,26 @@ sudo ./setup/install.sh
5050

5151
There's also a [quickstart here](http://www.powershellempire.com/?page_id=110) and full [documentation here](http://www.powershellempire.com/?page_id=83).
5252

53+
## Docker
54+
If you want to run Empire using a pre-built docker container:
55+
```bash
56+
docker pull bcsecurity/empire:{version}
57+
docker run -it bcsecurity/empire:{version}
58+
59+
# with persistent storage
60+
docker pull bcsecurity/empire:{version}
61+
docker create -v /empire --name data bcsecurity/empire:{version}
62+
docker run -it --volumes-from data bcsecurity/empire:{version}
63+
64+
# if you prefer to be dropped into bash instead of directly into empire
65+
# or docker run -it --volumes-from data bcsecurity/empire:{version} /bin/bash
66+
```
67+
68+
All image versions can be found at: https://hub.docker.com/r/bcsecurity/empire/
69+
* The last commit from master will be deployed to the `latest` tag
70+
* The last commit from the dev branch will be deployed to the `dev` tag
71+
* All github tagged releases will be deployed using their version numbers (v3.0, v3.1, etc)
72+
5373
## Quickstart
5474

5575
Check out the [Empire wiki](https://github.com/EmpireProject/Empire/wiki/Quickstart) for instructions on getting started with Empire.

setup/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ pyminifier
1717
xlutils
1818
pycrypto
1919
pefile
20+
simplejson

0 commit comments

Comments
 (0)