consider dropping in a docker file to boot up
Closed this issue · 0 comments
johndpope commented
https://github.com/Alustrat/homegrown-restyaboard/tree/5734867c7c1f02ce4299967954be31cca1513279
I attempted this - and have one working well with mysql - but needs more work.
Would be nice to be able to start environment with one command
docker-compose up
(needs some time to configure stuff)
# WARNING if you see mysql automatically stop upon start - you may need to run
# docker-compose up -d then docker-compose down -v
version: "3.7"
volumes:
mysql_data:
server:
services:
webapp:
build:
context: .
dockerfile: Dockerfile-web
args:
buildno: 1
ports:
- "2222:22"
- "3000:3000"
- "3001:3001"
- "3004:3004"
- "3005:3005"
depends_on:
- "mysql"
links:
- "mysql:database"
volumes:
- ./server:/home/node/8secondz/server
# WARNING
# I HAD TO run
# using kitematic / exec bash shell into mysql
# run this command
# mysql -h database -u 8secondz -p
# 8secondz!
# ALTER USER '8secondz' IDENTIFIED WITH mysql_native_password BY '8secondz!';
mysql:
build:
context: .
dockerfile: Dockerfile-mysql
ports:
# <Port exposed> : < MySQL Port running inside container>
- '3306:3306'
expose:
# Opens port 3306 on the container
- '3306'
volumes:
- ./mysql-data:/var/lib/mysql
environment:
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: "App8secondz-docker"
MYSQL_ROOT_PASSWORD: "mysql"
MYSQL_USER: ""
MYSQL_PASSWORD: ""
command: --default-authentication-plugin=mysql_native_password
restart: always
you can use an sql dump to initialize mysql credentials / db.
**Dockerfile-mysql**
FROM mysql:latest
ADD /data/8secondz-staging.sql /docker-entrypoint-initdb.d/
**Dockerfile-web**
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/
start the python