Skip to content

Commit

Permalink
Docker update (mitre#1795)
Browse files Browse the repository at this point in the history
* Update Dockerfile

* Update docker-compose

* Switch to ubuntu focal

* Update docker-compose to use timezone

* Restore command
  • Loading branch information
pviossat authored Jul 22, 2020
1 parent 1ce05d9 commit c1cbe37
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 18 deletions.
23 changes: 23 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# common
**/README.md
**/CONTRIBUTING.md
docker-compose.yml
Dockerfile

# git
**/.git
**/.gitattributes
**/.gitignore
**/.gitmodules
**/.github

# dev
tests/
**/.codecov.yml
**/.coveragerc
**/.flake8
**/.pre-commit-config.yaml
**/.travis.yml
**/release.sh
**/requirements-dev.txt
**/tox.ini
29 changes: 24 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
FROM ubuntu:bionic
FROM ubuntu:focal

ARG TZ="UTC"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
echo $TZ > /etc/timezone

WORKDIR /usr/src/app
ADD . /usr/src/app
ENV GOPATH=/usr/bin/go

RUN apt-get update && \
apt-get install python3 python3-pip golang git -y && \
pip3 install --no-cache-dir -r requirements.txt
apt-get -y install python3 python3-pip golang git

#WIN_BUILD is used to enable windows build in sandcat plugin
ARG WIN_BUILD=false
RUN if [ "$WIN_BUILD" = "true" ] ; then apt-get -y install mingw-w64; fi

ADD requirements.txt .

RUN pip3 install --no-cache-dir -r requirements.txt

ADD . .

EXPOSE 8888
EXPOSE 7010
EXPOSE 7011/udp
EXPOSE 7012

ENTRYPOINT ["python3", "server.py"]
22 changes: 9 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ version: '3'

services:
caldera:
image: python:3

expose:
- "8888"
- "7010"
- "7011"
- "7012"

build:
context: .
dockerfile: Dockerfile
args:
TZ: "UTC" #TZ sets timezone for ubuntu setup
WIN_BUILD: "false" #WIN_BUILD is used to enable windows build in sandcat plugin
image: caldera:latest
ports:
- "8888:8888"
- "7010:7010"
- "7011:7011"
- "7011:7011/udp"
- "7012:7012"
working_dir: /usr/src/app

volumes:
- ./:/usr/src/app

command: /bin/bash -c "pip install --no-cache-dir -r requirements.txt && python server.py --fresh --insecure"
command: --fresh --insecure

0 comments on commit c1cbe37

Please sign in to comment.