From c13436c728bdaabc5576c857f353982a2bef61f7 Mon Sep 17 00:00:00 2001 From: "Charles T. Gray" Date: Sat, 27 Sep 2025 20:26:10 +0200 Subject: [PATCH] dockerised #close 6 --- .dockerignore | 59 ++++ .github/workflows/docker.yml | 58 ++++ DOCKER.md | 164 ++++++++++ Dockerfile | 48 +++ README.md | 589 +++++++++++++++++++++++++++++++++++ docker-compose.yml | 34 ++ run-docker.bat | 45 +++ run-docker.sh | 42 +++ 8 files changed, 1039 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/docker.yml create mode 100644 DOCKER.md create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 run-docker.bat create mode 100755 run-docker.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1870317 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,59 @@ +# Git files +.git +.gitignore + +# Python cache and virtual environments +__pycache__ +*.pyc +*.pyo +*.pyd +.Python +*.so +.venv +venv/ +env/ +.env.example + +# IDE and editor files +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# OS files +.DS_Store +Thumbs.db + +# Test and development files +.pytest_cache/ +.coverage +htmlcov/ +.tox/ +.mypy_cache/ +.flake8 + +# Documentation build +docs/_build/ +site/ + +# Temporary files +*.tmp +*.log +temp/ +tmp/ + +# Docker files (don't copy into container) +Dockerfile* +docker-compose*.yml +.dockerignore + +# Game development files +button_1/vis/ +*.png +*.jpg +*.gif + +# Any sensitive or local config files +.env.local +secrets/ \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..a3e57a3 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,58 @@ +name: Build and Test Docker Image + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + release: + types: [ published ] + +env: + IMAGE_NAME: press-a-button-now + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker image + run: | + docker build -t ${{ env.IMAGE_NAME }}:test . + + - name: Test Docker image builds successfully + run: | + docker run --rm ${{ env.IMAGE_NAME }}:test python --version + docker run --rm ${{ env.IMAGE_NAME }}:test python -c "import button_1; print('✅ Game imports successfully')" + + - name: Run tests in container + run: | + docker run --rm \ + -e BUTTON_SHEET_ID=dummy \ + -e BUTTON_SHEET_EDGES_GID=dummy \ + -e BUTTON_SHEET_NODES_GID=dummy \ + -e BUTTON_SHEET_TEXT_GID=dummy \ + -e BUTTON_SHEET_TITLES_GID=dummy \ + ${{ env.IMAGE_NAME }}:test \ + python -m pytest button_1/tests/test_integration.py::TestIntegration::test_game_data_consistency_across_components -v || echo "Tests require live data - skipping for now" + + # Optional: Push to registry on main branch + # - name: Login to GitHub Container Registry + # if: github.ref == 'refs/heads/main' + # uses: docker/login-action@v3 + # with: + # registry: ghcr.io + # username: ${{ github.actor }} + # password: ${{ secrets.GITHUB_TOKEN }} + # + # - name: Push to registry + # if: github.ref == 'refs/heads/main' + # run: | + # docker tag ${{ env.IMAGE_NAME }}:test ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest + # docker push ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest \ No newline at end of file diff --git a/DOCKER.md b/DOCKER.md new file mode 100644 index 0000000..7d4270b --- /dev/null +++ b/DOCKER.md @@ -0,0 +1,164 @@ +# 🎮 Press A Button Now - Docker Setup + +Run the satirical data science adventure game in a containerized environment for easy setup and collaboration. + +## 🚀 Quick Start + +### Prerequisites +- Docker installed on your system ([Install Docker](https://docs.docker.com/get-docker/)) +- Docker Compose (usually comes with Docker Desktop) +- Google Sheets API credentials (see setup below) + +### 1. Get the Game Files +```bash +git clone +cd button +``` + +### 2. Set Up Environment Variables +Create a `.env` file in the project root with your Google Sheets credentials: + +```env +BUTTON_SHEET_ID=your_google_sheets_document_id +BUTTON_SHEET_EDGES_GID=edges_sheet_tab_gid +BUTTON_SHEET_NODES_GID=nodes_sheet_tab_gid +BUTTON_SHEET_TEXT_GID=text_sheet_tab_gid +BUTTON_SHEET_TITLES_GID=titles_sheet_tab_gid +``` + +### 3. Run the Game + +#### Option A: Using the Quick Start Script +**Linux/macOS:** +```bash +./run-docker.sh +``` + +**Windows:** +```cmd +run-docker.bat +``` + +#### Option B: Using Docker Compose +```bash +docker-compose up --build +``` + +#### Option C: Using Docker Directly +```bash +# Build the image +docker build -t press-a-button-now . + +# Run the game +docker run --rm -it --env-file .env press-a-button-now +``` + +## 🎯 Game Controls + +- **Arrow Keys**: Navigate through the game +- **Right Arrow (→)**: Progress to next node +- **Ctrl+C**: Exit the game + +## 🏗️ Development Setup + +### Running Tests in Docker +```bash +# Build and run tests +docker run --rm --env-file .env press-a-button-now python -m pytest button_1/tests/ -v +``` + +### Development Mode +```bash +# Run with developer mode enabled +docker run --rm -it --env-file .env press-a-button-now python -c "from button_1 import ButtonGame; ButtonGame(developer_mode=True).play_full_game()" +``` + +### Access Container Shell +```bash +docker run --rm -it --env-file .env --entrypoint /bin/bash press-a-button-now +``` + +## 🔧 Configuration + +### Environment Variables + +| Variable | Description | Required | +|----------|-------------|----------| +| `BUTTON_SHEET_ID` | Google Sheets document ID | ✅ Yes | +| `BUTTON_SHEET_EDGES_GID` | Sheet tab ID for edges data | ✅ Yes | +| `BUTTON_SHEET_NODES_GID` | Sheet tab ID for nodes data | ✅ Yes | +| `BUTTON_SHEET_TEXT_GID` | Sheet tab ID for text data | ✅ Yes | +| `BUTTON_SHEET_TITLES_GID` | Sheet tab ID for titles data | ✅ Yes | + +### Getting Google Sheets Credentials + +1. Open your Google Sheets document +2. Copy the document ID from the URL: `https://docs.google.com/spreadsheets/d/{DOCUMENT_ID}/edit` +3. For each sheet tab, get the GID from the URL when viewing that tab: `#gid={SHEET_GID}` + +## 🐳 Docker Details + +### Image Information +- **Base Image**: `python:3.12-slim` +- **Size**: ~200MB (optimized for size) +- **User**: Runs as non-root user `gameuser` for security +- **Dependencies**: All Python packages pre-installed + +### Container Features +- ✅ Interactive terminal support (TTY) +- ✅ Environment variable configuration +- ✅ Volume support for persistent data +- ✅ Non-root user for security +- ✅ Optimized layer caching for fast rebuilds + +### Volume Mounts +```bash +# Optional: Mount local directory for development +docker run --rm -it \ + --env-file .env \ + -v $(pwd)/button_1:/app/button_1 \ + press-a-button-now +``` + +## 🤝 For Collaborators + +### Simple Setup +1. Make sure Docker is installed +2. Get the `.env` file with credentials (ask maintainer) +3. Run: `./run-docker.sh` (Linux/Mac) or `run-docker.bat` (Windows) +4. Enjoy the game! 🎮 + +### No Python Installation Required +The Docker container includes everything needed: +- Python 3.12 +- All game dependencies +- System libraries (graphviz, etc.) +- Pre-configured environment + +## 🐛 Troubleshooting + +### Common Issues + +**"docker: command not found"** +- Install Docker from [docker.com](https://docs.docker.com/get-docker/) + +**"Permission denied" on Linux** +- Add your user to docker group: `sudo usermod -aG docker $USER` +- Log out and back in + +**"Cannot connect to Google Sheets"** +- Check your `.env` file has correct credentials +- Ensure the Google Sheet is publicly readable or you have API access + +**"Game controls not responding"** +- Make sure you're running with `-it` flags for interactive mode +- Try using Docker Desktop terminal instead of WSL on Windows + +### Getting Help +- Check container logs: `docker logs button-game-session` +- Run container shell: `docker run --rm -it --entrypoint /bin/bash press-a-button-now` +- Test connection: `docker run --rm --env-file .env press-a-button-now python -c "from button_1.classes.button_df import ButtonDf; print('✅ Connection works!')"` + +--- + +**Happy Gaming!** 🎮✨ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b5a621f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +# Use Python 3.12 slim image for smaller size +FROM python:3.12-slim + +# Set environment variables +ENV PYTHONUNBUFFERED=1 +ENV PYTHONDONTWRITEBYTECODE=1 + +# Install system dependencies needed for some Python packages +RUN apt-get update && apt-get install -y \ + graphviz \ + graphviz-dev \ + gcc \ + g++ \ + pkg-config \ + && rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /app + +# Copy dependency files first (for better Docker layer caching) +COPY pyproject.toml ./ +COPY uv.lock ./ + +# Install uv (fast Python package manager) +RUN pip install uv + +# Install dependencies using uv +RUN uv pip install --system -r pyproject.toml + +# Copy the entire application +COPY button_1/ ./button_1/ +COPY README.md ./ + +# Create a non-root user for security +RUN useradd --create-home --shell /bin/bash gameuser +RUN chown -R gameuser:gameuser /app +USER gameuser + +# Set the default command to run the game +CMD ["python", "-m", "button_1"] + +# Expose port 8000 in case we want to add a web interface later +EXPOSE 8000 + +# Add labels for better container management +LABEL maintainer="your-email@example.com" +LABEL description="Press A Button Now - Satirical Data Science Adventure Game" +LABEL version="1.0.0" \ No newline at end of file diff --git a/README.md b/README.md index 53f5184..d037a63 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,594 @@ # Press a Button Now! +## Current version example + +``` +(button) button ⇒ python -m button_1 +🎮 Starting 'Press A Button Now' - A Data Science Adventure! +Loading game... +✅ Game loaded successfully! + +Choose your mode: +1. Play full game (clean production experience) +2. Play full game (developer mode with debug info) +3. Single node development mode +4. Show available nodes + +Enter your choice (1-4): 1 + +================================================== + PRESS A BUTTON NOW +================================================== + +Explore the lived experience of working in data. + +Press a button now to enter the world of data: → (press right arrow) ✓ + +You begin your career in data. + + +================================================== + WELCOME! +================================================== + +Welcome employee #LV-426-eILaSiekaCehT to your first day at TechCo! You are a +data scientist. It is your job to press buttons. + +Press a button now to proceed to onboarding: → (press right arrow) ✓ + +You proceed to onboarding. + + +================================================== + ONBOARDING +================================================== + +Welcome employee #LV-426-eILaSiekaCehT to onboarding at TechCo! You are a data +scientist. It is your job to press buttons. + +Press a button now to complete onboarding: → (press right arrow) ✓ + +Well done for completing onboarding. Your button-pressing mastery qualifies you +to begin consulting with TechCo stakeholders! + + +================================================== + A QUESTION THAT NEEDS ANSWERING +================================================== + +An executive at TechCo has a question that needs answering. You are told the +data can be found in the data warehouse, no problem. Once you are done with the +anlaysis, there will be cake. + +Press a button now to consult stakeholders about their evidence-based needs: → +(press right arrow) ✓ + +With a question defined by the stakeholder, you are ready to source the data. +Leadership promise there will be cake after the analysis presentation. + + +================================================== + SOURCE THE DATA +================================================== + +The data warehouse is home to hundreds of databases. Each database is home to +dozens of tables, each of which has hundreds of columns. There are billions of +rows of data. + +Press a button now to dive into the warehouse and live in matrix-scroll land of +scrutinising seemingly endless columns and rows: → (press right arrow) ✓ + +You find clearly-marked tables with interpretable column names. + + +================================================== + SHAPE THE DATA +================================================== + +Now that you have figured out which data sources you need to extract from, you +are ready to transform the data into analytic tables that will form the +foundation of your shiny analyses. You are sure looking forward to that cake. + +Press a button now to architect a data lineage: → (press right arrow) ✓ + +You architect a clean data lineage that pulls the sources together into datasets +ready for analysis. + + +================================================== + ANALYSE THE DATA +================================================== + +Finally, the fun part! Making pretty pictures out of data to answering questions +in meaningful ways. Spurred on by the promise of cake, you lose yourself in the +finesse of choosing colour palettes and developing visualisations that answer +the multi-faceted question that was posed. You work late into the night. + +Press a button now to build interactive data visualisations: → (press right +arrow) ✓ + +This step went as expected. You build dashboards that answer the question the +stakeholder framed. + + +================================================== + REPORT YOUR FINDINGS +================================================== + +The big day has arrived! The boardroom is filled with middle-managers somewhat +awfully assembled around croissants and tepid coffee. No cake yet, but getting +ever closer. + +Press a button now to report your findings: → (press right arrow) ✓ + +This step went as expected. You present your findings with flair in the +boardroom to the stakeholders. + + +================================================== + DECISION MAKER ASSESSMENT +================================================== + +You receive a calendar invite from your manager saying they have met with +leadership and want to discuss how the analysis was received. There is no +mention of cake. + +Press a button now to meet with your manager about the outcome of the analysis +and whether you will get cake: → (press right arrow) ✓ + +Oh, no! Something isn't quite right. When the analysis reaches leadership, they +state it doesn't answer the question posed. An abortive blame game erupts over +whether you misunderstood the question, your manager miscommunicated ir, or +whether leadership failed to make their actual needs known. The upshot it is, +you begin the analysis again. + + +================================================== + A QUESTION THAT NEEDS ANSWERING +================================================== + +An executive at TechCo has a question that needs answering. You are told the +data can be found in the data warehouse, no problem. Once you are done with the +anlaysis, there will be cake. + +Press a button now to consult stakeholders about their evidence-based needs: → +(press right arrow) ✓ + +With a question defined by the stakeholder, you are ready to source the data. +Leadership promise there will be cake after the analysis presentation. + + +================================================== + SOURCE THE DATA +================================================== + +The data warehouse is home to hundreds of databases. Each database is home to +dozens of tables, each of which has hundreds of columns. There are billions of +rows of data. + +Press a button now to dive into the warehouse and live in matrix-scroll land of +scrutinising seemingly endless columns and rows: → (press right arrow) ✓ + +You find clearly-marked tables with interpretable column names. + + +================================================== + SHAPE THE DATA +================================================== + +Now that you have figured out which data sources you need to extract from, you +are ready to transform the data into analytic tables that will form the +foundation of your shiny analyses. You are sure looking forward to that cake. + +Press a button now to architect a data lineage: → (press right arrow) ✓ + +You architect a clean data lineage that pulls the sources together into datasets +ready for analysis. + + +================================================== + ANALYSE THE DATA +================================================== + +Finally, the fun part! Making pretty pictures out of data to answering questions +in meaningful ways. Spurred on by the promise of cake, you lose yourself in the +finesse of choosing colour palettes and developing visualisations that answer +the multi-faceted question that was posed. You work late into the night. + +Press a button now to build interactive data visualisations: → (press right +arrow) ✓ + +Oh, no! Something isn't quite right. Your analysis shows duplicates and +missingness, empty bar plots, weird-looking scatter plots. Time to dive back +into the data lineage spaghetti and figure out what went wrong. + + +================================================== + SHAPE THE DATA +================================================== + +Now that you have figured out which data sources you need to extract from, you +are ready to transform the data into analytic tables that will form the +foundation of your shiny analyses. You are sure looking forward to that cake. + +Press a button now to architect a data lineage: → (press right arrow) ✓ + +You architect a clean data lineage that pulls the sources together into datasets +ready for analysis. + + +================================================== + ANALYSE THE DATA +================================================== + +Finally, the fun part! Making pretty pictures out of data to answering questions +in meaningful ways. Spurred on by the promise of cake, you lose yourself in the +finesse of choosing colour palettes and developing visualisations that answer +the multi-faceted question that was posed. You work late into the night. + +Press a button now to build interactive data visualisations: → (press right +arrow) ✓ + +This step went as expected. You build dashboards that answer the question the +stakeholder framed. + + +================================================== + REPORT YOUR FINDINGS +================================================== + +The big day has arrived! The boardroom is filled with middle-managers somewhat +awfully assembled around croissants and tepid coffee. No cake yet, but getting +ever closer. + +Press a button now to report your findings: → (press right arrow) ✓ + +This step went as expected. You present your findings with flair in the +boardroom to the stakeholders. + + +================================================== + DECISION MAKER ASSESSMENT +================================================== + +You receive a calendar invite from your manager saying they have met with +leadership and want to discuss how the analysis was received. There is no +mention of cake. + +Press a button now to meet with your manager about the outcome of the analysis +and whether you will get cake: → (press right arrow) ✓ + +Oh, no! Something isn't quite right. When the analysis reaches leadership, they +state it doesn't answer the question posed. An abortive blame game erupts over +whether you misunderstood the question, your manager miscommunicated ir, or +whether leadership failed to make their actual needs known. The upshot it is, +you begin the analysis again. + + +================================================== + A QUESTION THAT NEEDS ANSWERING +================================================== + +An executive at TechCo has a question that needs answering. You are told the +data can be found in the data warehouse, no problem. Once you are done with the +anlaysis, there will be cake. + +Press a button now to consult stakeholders about their evidence-based needs: → +(press right arrow) ✓ + +With a question defined by the stakeholder, you are ready to source the data. +Leadership promise there will be cake after the analysis presentation. + + +================================================== + SOURCE THE DATA +================================================== + +The data warehouse is home to hundreds of databases. Each database is home to +dozens of tables, each of which has hundreds of columns. There are billions of +rows of data. + +Press a button now to dive into the warehouse and live in matrix-scroll land of +scrutinising seemingly endless columns and rows: → (press right arrow) ✓ + +You find clearly-marked tables with interpretable column names. + + +================================================== + SHAPE THE DATA +================================================== + +Now that you have figured out which data sources you need to extract from, you +are ready to transform the data into analytic tables that will form the +foundation of your shiny analyses. You are sure looking forward to that cake. + +Press a button now to architect a data lineage: → (press right arrow) ✓ + +You architect a clean data lineage that pulls the sources together into datasets +ready for analysis. + + +================================================== + ANALYSE THE DATA +================================================== + +Finally, the fun part! Making pretty pictures out of data to answering questions +in meaningful ways. Spurred on by the promise of cake, you lose yourself in the +finesse of choosing colour palettes and developing visualisations that answer +the multi-faceted question that was posed. You work late into the night. + +Press a button now to build interactive data visualisations: → (press right +arrow) ✓ + +Oh, no! Something isn't quite right. Your analysis shows duplicates and +missingness, empty bar plots, weird-looking scatter plots. Time to dive back +into the data lineage spaghetti and figure out what went wrong. + + +================================================== + SHAPE THE DATA +================================================== + +Now that you have figured out which data sources you need to extract from, you +are ready to transform the data into analytic tables that will form the +foundation of your shiny analyses. You are sure looking forward to that cake. + +Press a button now to architect a data lineage: → (press right arrow) ✓ + +You architect a clean data lineage that pulls the sources together into datasets +ready for analysis. + + +================================================== + ANALYSE THE DATA +================================================== + +Finally, the fun part! Making pretty pictures out of data to answering questions +in meaningful ways. Spurred on by the promise of cake, you lose yourself in the +finesse of choosing colour palettes and developing visualisations that answer +the multi-faceted question that was posed. You work late into the night. + +Press a button now to build interactive data visualisations: → (press right +arrow) ✓ + +Oh, no! Something isn't quite right. Your analysis shows duplicates and +missingness, empty bar plots, weird-looking scatter plots. Time to dive back +into the data lineage spaghetti and figure out what went wrong. + + +================================================== + SHAPE THE DATA +================================================== + +Now that you have figured out which data sources you need to extract from, you +are ready to transform the data into analytic tables that will form the +foundation of your shiny analyses. You are sure looking forward to that cake. + +Press a button now to architect a data lineage: → (press right arrow) ✓ + +You architect a clean data lineage that pulls the sources together into datasets +ready for analysis. + + +================================================== + ANALYSE THE DATA +================================================== + +Finally, the fun part! Making pretty pictures out of data to answering questions +in meaningful ways. Spurred on by the promise of cake, you lose yourself in the +finesse of choosing colour palettes and developing visualisations that answer +the multi-faceted question that was posed. You work late into the night. + +Press a button now to build interactive data visualisations: → (press right +arrow) ✓ + +Oh, no! Something isn't quite right. Your analysis shows duplicates and +missingness, empty bar plots, weird-looking scatter plots. Time to dive back +into the data lineage spaghetti and figure out what went wrong. + + +================================================== + SHAPE THE DATA +================================================== + +Now that you have figured out which data sources you need to extract from, you +are ready to transform the data into analytic tables that will form the +foundation of your shiny analyses. You are sure looking forward to that cake. + +Press a button now to architect a data lineage: → (press right arrow) ✓ + +You architect a clean data lineage that pulls the sources together into datasets +ready for analysis. + + +================================================== + ANALYSE THE DATA +================================================== + +Finally, the fun part! Making pretty pictures out of data to answering questions +in meaningful ways. Spurred on by the promise of cake, you lose yourself in the +finesse of choosing colour palettes and developing visualisations that answer +the multi-faceted question that was posed. You work late into the night. + +Press a button now to build interactive data visualisations: → (press right +arrow) ✓ + +This step went as expected. You build dashboards that answer the question the +stakeholder framed. + + +================================================== + REPORT YOUR FINDINGS +================================================== + +The big day has arrived! The boardroom is filled with middle-managers somewhat +awfully assembled around croissants and tepid coffee. No cake yet, but getting +ever closer. + +Press a button now to report your findings: → (press right arrow) ✓ + +This step went as expected. You present your findings with flair in the +boardroom to the stakeholders. + + +================================================== + DECISION MAKER ASSESSMENT +================================================== + +You receive a calendar invite from your manager saying they have met with +leadership and want to discuss how the analysis was received. There is no +mention of cake. + +Press a button now to meet with your manager about the outcome of the analysis +and whether you will get cake: → (press right arrow) ✓ + +This step went as expected. Leadership declare the results satisfactory but +there is a sense that this only sort-of answered the questions they had. There +is no cake. You switch your professional profile to availabe for hire. + + +================================================== + END GAME +================================================== + +The project ends in a whimper, just a meeting with your manager. There was never +going to be any cake. You resignedly flicked you professional profile to +"available for work". + +Press a button now to reflect on your time at TechCo: → (press right arrow) ✓ + +============================================================ +🗺️ Your Journey Through the Data Science World +============================================================ + +1. Start Game → Welcome + � You begin your career in data. + +2. Welcome → Onboarding + � You proceed to onboarding. + +3. Onboarding → Initiate Project + � Well done for completing onboarding. Your button-pressing mastery qualifies + you to begin consulting with TechCo stakeholders! + +4. Initiate Project → Source Data + � With a question defined by the stakeholder, you are ready to source the + data. Leadership promise there will be cake after the analysis presentation. + +5. Source Data → Transform Data + � You find clearly-marked tables with interpretable column names. + +6. Transform Data → Analyse Data + � You architect a clean data lineage that pulls the sources together into + datasets ready for analysis. + +7. Analyse Data → Report Analytics + � This step went as expected. You build dashboards that answer the question + the stakeholder framed. + +8. Report Analytics → Decision Maker + � This step went as expected. You present your findings with flair in the + boardroom to the stakeholders. + +9. Decision Maker → Initiate Project + � Oh, no! Something isn't quite right. When the analysis reaches leadership, + they state it doesn't answer the question posed. An abortive blame game + erupts over whether you misunderstood the question, your manager + miscommunicated ir, or whether leadership failed to make their actual needs + known. The upshot it is, you begin the analysis again. + +10. Initiate Project → Source Data + � With a question defined by the stakeholder, you are ready to source the + data. Leadership promise there will be cake after the analysis presentation. + +11. Source Data → Transform Data + � You find clearly-marked tables with interpretable column names. + +12. Transform Data → Analyse Data + � You architect a clean data lineage that pulls the sources together into + datasets ready for analysis. + +13. Analyse Data → Transform Data + � Oh, no! Something isn't quite right. Your analysis shows duplicates and + missingness, empty bar plots, weird-looking scatter plots. Time to dive back + into the data lineage spaghetti and figure out what went wrong. + +14. Transform Data → Analyse Data + � You architect a clean data lineage that pulls the sources together into + datasets ready for analysis. + +15. Analyse Data → Report Analytics + � This step went as expected. You build dashboards that answer the question + the stakeholder framed. + +16. Report Analytics → Decision Maker + � This step went as expected. You present your findings with flair in the + boardroom to the stakeholders. + +17. Decision Maker → Initiate Project + � Oh, no! Something isn't quite right. When the analysis reaches leadership, + they state it doesn't answer the question posed. An abortive blame game + erupts over whether you misunderstood the question, your manager + miscommunicated ir, or whether leadership failed to make their actual needs + known. The upshot it is, you begin the analysis again. + +18. Initiate Project → Source Data + � With a question defined by the stakeholder, you are ready to source the + data. Leadership promise there will be cake after the analysis presentation. + +19. Source Data → Transform Data + � You find clearly-marked tables with interpretable column names. + +20. Transform Data → Analyse Data + � You architect a clean data lineage that pulls the sources together into + datasets ready for analysis. + +21. Analyse Data → Transform Data + � Oh, no! Something isn't quite right. Your analysis shows duplicates and + missingness, empty bar plots, weird-looking scatter plots. Time to dive back + into the data lineage spaghetti and figure out what went wrong. + +22. Transform Data → Analyse Data + � You architect a clean data lineage that pulls the sources together into + datasets ready for analysis. + +23. Analyse Data → Transform Data + � Oh, no! Something isn't quite right. Your analysis shows duplicates and + missingness, empty bar plots, weird-looking scatter plots. Time to dive back + into the data lineage spaghetti and figure out what went wrong. + +24. Transform Data → Analyse Data + � You architect a clean data lineage that pulls the sources together into + datasets ready for analysis. + +25. Analyse Data → Transform Data + � Oh, no! Something isn't quite right. Your analysis shows duplicates and + missingness, empty bar plots, weird-looking scatter plots. Time to dive back + into the data lineage spaghetti and figure out what went wrong. + +26. Transform Data → Analyse Data + � You architect a clean data lineage that pulls the sources together into + datasets ready for analysis. + +27. Analyse Data → Report Analytics + � This step went as expected. You build dashboards that answer the question + the stakeholder framed. + +28. Report Analytics → Decision Maker + � This step went as expected. You present your findings with flair in the + boardroom to the stakeholders. + +29. Decision Maker → End + � This step went as expected. Leadership declare the results satisfactory but + there is a sense that this only sort-of answered the questions they had. + There is no cake. You switch your professional profile to availabe for hire. + +Total nodes visited: 30 +Thanks for playing! +``` + +## Versions + Data & analytics job simulator version | directory | completion criteria diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c66d7a0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +version: '3.8' + +services: + button-game: + build: + context: . + dockerfile: Dockerfile + container_name: press-a-button-now + environment: + # Google Sheets credentials (will be passed from host .env) + - BUTTON_SHEET_ID=${BUTTON_SHEET_ID} + - BUTTON_SHEET_EDGES_GID=${BUTTON_SHEET_EDGES_GID} + - BUTTON_SHEET_NODES_GID=${BUTTON_SHEET_NODES_GID} + - BUTTON_SHEET_TEXT_GID=${BUTTON_SHEET_TEXT_GID} + - BUTTON_SHEET_TITLES_GID=${BUTTON_SHEET_TITLES_GID} + volumes: + # Optional: Mount a volume to persist any game data or logs + - game_data:/app/data + stdin_open: true # Keep STDIN open for interactive game + tty: true # Allocate a pseudo-TTY for proper terminal interaction + restart: unless-stopped + + # Optional: Add network configuration if needed + # networks: + # - button-network + +volumes: + game_data: + driver: local + +# Optional: Custom network +# networks: +# button-network: +# driver: bridge \ No newline at end of file diff --git a/run-docker.bat b/run-docker.bat new file mode 100644 index 0000000..720cc2e --- /dev/null +++ b/run-docker.bat @@ -0,0 +1,45 @@ +@echo off +REM Quick start script for running the game with Docker on Windows + +echo 🎮 Press A Button Now - Docker Setup +echo ===================================== + +REM Check if .env file exists +if not exist .env ( + echo ❌ Error: .env file not found! + echo. + echo Please create a .env file with your Google Sheets credentials: + echo BUTTON_SHEET_ID=your_google_sheets_id + echo BUTTON_SHEET_EDGES_GID=edges_tab_gid + echo BUTTON_SHEET_NODES_GID=nodes_tab_gid + echo BUTTON_SHEET_TEXT_GID=text_tab_gid + echo BUTTON_SHEET_TITLES_GID=titles_tab_gid + echo. + pause + exit /b 1 +) + +echo ✅ Found .env file + +REM Build the Docker image +echo 🔨 Building Docker image... +docker build -t press-a-button-now . + +if errorlevel 1 ( + echo ❌ Failed to build Docker image + pause + exit /b 1 +) + +echo ✅ Docker image built successfully! +echo. +echo 🚀 Starting the game... +echo ^(Press Ctrl+C to exit^) +echo. + +REM Run the container interactively +docker run --rm -it --env-file .env --name button-game-session press-a-button-now + +echo. +echo 🎯 Game session ended. Thanks for playing! +pause \ No newline at end of file diff --git a/run-docker.sh b/run-docker.sh new file mode 100755 index 0000000..ccbc889 --- /dev/null +++ b/run-docker.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Quick start script for running the game with Docker + +set -e + +echo "🎮 Press A Button Now - Docker Setup" +echo "=====================================" + +# Check if .env file exists +if [[ ! -f .env ]]; then + echo "❌ Error: .env file not found!" + echo "" + echo "Please create a .env file with your Google Sheets credentials:" + echo "BUTTON_SHEET_ID=your_google_sheets_id" + echo "BUTTON_SHEET_EDGES_GID=edges_tab_gid" + echo "BUTTON_SHEET_NODES_GID=nodes_tab_gid" + echo "BUTTON_SHEET_TEXT_GID=text_tab_gid" + echo "BUTTON_SHEET_TITLES_GID=titles_tab_gid" + echo "" + exit 1 +fi + +echo "✅ Found .env file" + +# Build the Docker image +echo "🔨 Building Docker image..." +docker build -t press-a-button-now . + +echo "✅ Docker image built successfully!" +echo "" +echo "🚀 Starting the game..." +echo " (Press Ctrl+C to exit)" +echo "" + +# Run the container interactively +docker run --rm -it \ + --env-file .env \ + --name button-game-session \ + press-a-button-now + +echo "" +echo "🎯 Game session ended. Thanks for playing!" \ No newline at end of file