forked from localstack/localstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
87 lines (69 loc) 路 2.98 KB
/
Copy pathDockerfile
File metadata and controls
87 lines (69 loc) 路 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
FROM maven:alpine
LABEL authors="Waldemar Hummer (whummer@atlassian.com), Gianluca Bortoli (giallogiallo93@gmail.com)"
# install general packages
RUN apk update && \
apk add --update autoconf automake build-base ca-certificates docker git libffi-dev libtool linux-headers make nodejs openssl openssl-dev python python-dev py-pip supervisor zip && \
update-ca-certificates
# set workdir
RUN mkdir -p /opt/code/localstack
WORKDIR /opt/code/localstack/
# init environment and cache some dependencies
ADD requirements.txt .
RUN wget -O /tmp/localstack.es.zip https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.0.zip && \
(pip install --upgrade pip) && \
(test `which virtualenv` || \
pip install virtualenv || \
sudo pip install virtualenv) && \
(virtualenv .testvenv && \
source .testvenv/bin/activate && \
pip install -r requirements.txt && \
rm -rf .testvenv)
# add files required to run "make install-web"
ADD Makefile .
ADD localstack/dashboard/web/package.json localstack/dashboard/web/package.json
# install web dashboard dependencies
RUN make install-web
# add files required to run "make install"
RUN mkdir -p localstack/utils/kinesis/ && touch localstack/__init__.py localstack/utils/__init__.py localstack/utils/kinesis/__init__.py
ADD localstack/utils/kinesis/ localstack/utils/kinesis/
ADD localstack/utils/common.py localstack/utils/common.py
ADD localstack/constants.py localstack/constants.py
# install dependencies
# TODO: temporary change to fix error "Cannot find module 'semver'" when running npm
RUN make install && \
rm -rf /usr/lib/node_modules && apk del nodejs && apk add --update nodejs && npm install npm@latest -g
# add files required to run "make init"
ADD localstack/config.py localstack/config.py
ADD localstack/mock/__init__.py localstack/mock/install.py localstack/mock/
# initialize installation (downloads remaining dependencies)
RUN make init
# add rest of the code
ADD localstack/ localstack/
# fix some permissions and create local user
RUN mkdir -p /.npm && \
mkdir -p localstack/infra/elasticsearch/data && \
chmod 777 . && \
chmod 755 /root && \
chmod -R 777 /.npm && \
chmod -R 777 localstack/infra/elasticsearch/config && \
chmod -R 777 localstack/infra/elasticsearch/data && \
chmod -R 777 localstack/infra/elasticsearch/logs && \
chmod -R 777 /tmp/localstack && \
adduser -D localstack
# install supervisor daemon & copy config file
ADD supervisord.conf /etc/supervisord.conf
# add files for web dashboard
ADD bin/localstack bin/localstack
# expose default environment (required for aws-cli to work)
ENV AWS_ACCESS_KEY_ID=foobar \
AWS_SECRET_ACCESS_KEY=foobar \
AWS_DEFAULT_REGION=us-east-1 \
MAVEN_CONFIG=/opt/code/localstack \
USER=localstack
# run tests (to verify the build before pushing the image)
ADD tests/ tests/
RUN make test
# expose service & web dashboard ports
EXPOSE 4567-4581 8080
# define command at startup
ENTRYPOINT ["/usr/bin/supervisord"]