Skip to content

Commit a635293

Browse files
authored
Multiplatform support (#452)
* tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * fix Cowrie search field * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * tentative * multi platform support * multi platform support * multi platform support
1 parent 8de6103 commit a635293

File tree

7 files changed

+51
-3
lines changed

7 files changed

+51
-3
lines changed

.dockerignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.gitignore
2+
.git
3+
.vscode
4+
.lgtm.yml
5+
__pycache__
6+
venv/
7+
**/build
8+
.env
9+
docker/env_file_*
10+
docker/custom.override.yml
11+
**/docker-compose.*
12+
docs/
13+
frontend/node_modules
14+
frontend/dist
15+
frontend/build
16+
docker-compose*
17+
.pre-commit-config.yaml
18+
.ipython/

docker/Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,22 @@ RUN mkdir -p ${LOG_PATH} \
2929
&& apk --no-cache -U add bash py3-psycopg2 gcc python3-dev alpine-sdk linux-headers \
3030
&& pip3 install --no-cache-dir --upgrade pip
3131

32+
COPY requirements/project-requirements.txt $PYTHONPATH/project-requirements.txt
3233
WORKDIR $PYTHONPATH
34+
RUN pip3 install --no-cache-dir --compile -r $PYTHONPATH/project-requirements.txt
35+
3336
COPY . $PYTHONPATH
3437
COPY --from=frontend-build /build /var/www/reactapp
3538

3639
# separation is required to avoid to re-execute os installation in case of change of python requirements
37-
RUN pip3 install --no-cache-dir --compile -r $PYTHONPATH/requirements/project-requirements.txt \
38-
&& touch ${LOG_PATH}/django/api.log ${LOG_PATH}/django/api_errors.log \
40+
RUN touch ${LOG_PATH}/django/api.log ${LOG_PATH}/django/api_errors.log \
3941
&& touch ${LOG_PATH}/django/greedybear.log ${LOG_PATH}/django/greedybear_errors.log \
4042
&& touch ${LOG_PATH}/django/celery.log ${LOG_PATH}/django/celery_errors.log \
4143
&& touch ${LOG_PATH}/django/django_errors.log ${LOG_PATH}/django/elasticsearch.log\
4244
&& touch ${LOG_PATH}/django/authentication.log ${LOG_PATH}/django/authentication_errors.log \
4345
&& adduser -S -H -u 2000 -D -g www-data www-data \
4446
&& chown -R www-data:www-data ${LOG_PATH} /opt/deploy/ \
45-
&& rm -rf docs/ frontend/ tests/ .github/ \
47+
&& rm -rf docs/ frontend/ tests/ .github/ docker/hooks/ \
4648
&& /bin/bash ./docker/watchman_install.sh \
4749
&& apk del gcc python3-dev alpine-sdk linux-headers
4850

docker/hooks/build

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
echo "display path"
4+
echo "$(pwd)"
5+
echo "display dockerfile path"
6+
echo $DOCKERFILE_PATH
7+
cd ..
8+
echo "display path"
9+
echo "$(pwd)"
10+
echo "current branch"
11+
echo "$SOURCE_BRANCH"
12+
13+
if [[ "$SOURCE_BRANCH" == "main" ]]; then
14+
echo "The branch is main, proceeding with multi-arch build"
15+
docker buildx create --name multiarch --use
16+
docker buildx build -f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" --platform linux/arm64,linux/amd64,windows-amd64 --push .
17+
else
18+
echo "The branch is not main, proceeding with classic build"
19+
docker buildx build -f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" --push .
20+
fi

docker/hooks/post_push

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
if [[ "$SOURCE_BRANCH" == "main" ]]; then
4+
curl -d "text=A new production image has been pushed to Docker Hub" -d "channel=$SLACK_CHANNEL" -H "Authorization: Bearer $SLACK_TOKEN" -X POST https://slack.com/api/chat.postMessage
5+
fi

docker/logrotate/application

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
daily
33
missingok
44
rotate 2
5+
size 10M
56
compress
67
delaycompress
78
notifempty

docker/logrotate/docker

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
daily
33
missingok
44
rotate 2
5+
size 10M
56
compress
67
delaycompress
78
notifempty

docker/logrotate/nginx

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
daily
33
missingok
44
rotate 8
5+
size 1M
56
compress
67
delaycompress
78
notifempty

0 commit comments

Comments
 (0)