dockerizing the remaining components, prepping for stage deployment
parent
feaa025380
commit
e44cb91b10
@ -0,0 +1,10 @@
|
|||||||
|
.venv
|
||||||
|
.env
|
||||||
|
.git
|
||||||
|
.dockerignore
|
||||||
|
data
|
||||||
|
media
|
||||||
|
docker-compose.yaml
|
||||||
|
Dockerfile
|
||||||
|
Dockerfile-monero
|
||||||
|
README.md
|
@ -0,0 +1,32 @@
|
|||||||
|
FROM ubuntu:19.04
|
||||||
|
|
||||||
|
ENV MONERO_VERSION v0.15.0.1
|
||||||
|
ENV MONERO_HASH 8d61f992a7e2dbc3d753470b4928b5bb9134ea14cf6f2973ba11d1600c0ce9ad
|
||||||
|
ENV MONERO_DL_FILE monero.tar.bz2
|
||||||
|
ENV MONERO_SUMS_FILE sha256sums
|
||||||
|
|
||||||
|
WORKDIR /opt/monero
|
||||||
|
|
||||||
|
# Update system and install dependencies
|
||||||
|
# Download Monero binaries from Github
|
||||||
|
# Confirm hashes match
|
||||||
|
# Install daemon binary
|
||||||
|
# Clean up
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get upgrade -y \
|
||||||
|
&& apt-get install -y tar wget \
|
||||||
|
&& wget -qO ${MONERO_DL_FILE} https://github.com/monero-project/monero/releases/download/${MONERO_VERSION}/monero-linux-x64-${MONERO_VERSION}.tar.bz2 \
|
||||||
|
&& echo "${MONERO_HASH} ${MONERO_DL_FILE}" > ${MONERO_SUMS_FILE} \
|
||||||
|
&& sha256sum -c ${MONERO_SUMS_FILE}; \
|
||||||
|
if [ "$?" -eq 0 ]; \
|
||||||
|
then \
|
||||||
|
echo -e "[+] Hashes match - proceeding with container build"; \
|
||||||
|
else \
|
||||||
|
echo -e "[!] Hashes do not match - exiting"; \
|
||||||
|
exit 5; \
|
||||||
|
fi \
|
||||||
|
&& mkdir ./tmp \
|
||||||
|
&& tar xjf ${MONERO_DL_FILE} -C ./tmp --strip 1 \
|
||||||
|
&& mv ./tmp/* /usr/local/bin/ \
|
||||||
|
&& rm -rf ./tmp ${MONERO_SUMS_FILE} ${MONERO_DL_FILE}
|
@ -0,0 +1,14 @@
|
|||||||
|
FROM python:3
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install python3 python3-venv -y
|
||||||
|
RUN useradd -M -s /bin/bash -b /srv/xmrauctions xmrauctions
|
||||||
|
COPY . /srv/xmrauctions
|
||||||
|
RUN chown -R xmrauctions:xmrauctions /srv/xmrauctions
|
||||||
|
|
||||||
|
USER xmrauctions
|
||||||
|
WORKDIR /srv/xmrauctions
|
||||||
|
RUN python3 -m venv .venv && . .venv/bin/activate && pip install -r requirements.txt
|
||||||
|
RUN chmod +x ./bin/*
|
||||||
|
|
||||||
|
ENTRYPOINT ["./bin/entrypoint"]
|
@ -0,0 +1,27 @@
|
|||||||
|
.PHONY: format help
|
||||||
|
|
||||||
|
# Help system from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
||||||
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
|
help:
|
||||||
|
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
||||||
|
build: ## Build all the required containers
|
||||||
|
docker build -t monero -f Dockerfile-monero .
|
||||||
|
docker build -t xmrauctions -f Dockerfile-xmrauctions .
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Stage
|
||||||
|
|
||||||
|
stage-up: ## Run the stage containers
|
||||||
|
docker-compose -f docker-compose.yaml -f docker-compose.stage.yaml up -d
|
||||||
|
|
||||||
|
stage-ps: ## Show containers
|
||||||
|
docker-compose -f docker-compose.yaml -f docker-compose.stage.yaml ps
|
||||||
|
|
||||||
|
stage-logs: ## Show logs
|
||||||
|
docker-compose -f docker-compose.yaml -f docker-compose.stage.yaml logs -f
|
||||||
|
|
||||||
|
stage-static: ## Collect static
|
||||||
|
docker run --rm --env-file=.env xmrauctions ./manage.py collectstatic --no-input
|
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Wrapper script will activate the virtual environment so
|
||||||
|
# we don't need to do so every time we run the container
|
||||||
|
|
||||||
|
source .venv/bin/activate
|
||||||
|
exec "$@"
|
@ -0,0 +1,9 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
gunicorn:
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
image: xmrauctions:latest
|
||||||
|
command: [".venv/bin/gunicorn", "-b", "0.0.0.0:8000", "xmrauctions.wsgi"]
|
||||||
|
ports:
|
||||||
|
- 8000:8000
|
Reference in New Issue