-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
3,411 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Install Requirements | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
tasks: | ||
- name: Install roles from Ansible Galaxy | ||
command: ansible-galaxy install {{ item }} | ||
with_items: | ||
- "geerlingguy.docker" |
2 changes: 2 additions & 0 deletions
2
.devcontainer/ansible/roles/setup-container/defaults/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dotfiles_url: "{{ lookup('env', 'DOTFILES_URL') }}" | ||
dotfiles_path: "{{ lookup('env', 'HOME') + '/.dotfiles' }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dependencies: | ||
- { role: geerlingguy.docker, become: true } |
13 changes: 13 additions & 0 deletions
13
.devcontainer/ansible/roles/setup-container/tasks/dotfiles.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- name: Clone/Update git repo {{ dotfiles_url }} to {{ dotfiles_path }} | ||
git: | ||
repo: "{{ dotfiles_url }}" | ||
dest: "{{ dotfiles_path }}" | ||
recursive: yes # Recursively clone submodules | ||
update: yes | ||
force: yes | ||
accept_hostkey: yes | ||
ignore_errors: yes | ||
|
||
- name: Execute {{ dotfiles_path }}/install | ||
command: "{{ dotfiles_path }}/install" | ||
ignore_errors: yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- include_tasks: ssh.yml | ||
- include_tasks: dotfiles.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
- name: et permissions on ~/.ssh | ||
file: | ||
path: "{{ lookup('env', 'HOME') + '/.ssh' }}" | ||
state: directory | ||
owner: "{{ lookup('env', 'USER') }}" | ||
group: "{{ lookup('env', 'USER') }}" | ||
recurse: true | ||
mode: '0700' | ||
|
||
- name: Set permissions for ~/.ssh files | ||
file: | ||
path: "{{ item }}" | ||
mode: '0600' | ||
owner: "{{ lookup('env', 'USER') }}" | ||
group: "{{ lookup('env', 'USER') }}" | ||
with_fileglob: | ||
- "{{ lookup('env', 'HOME') }}/.ssh/*" | ||
|
||
- name: Setup and start ssh-agent | ||
shell: | | ||
ssh-add | ||
eval "$(ssh-agent)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Setup container | ||
hosts: localhost | ||
connection: local | ||
gather_facts: true | ||
vars: | ||
# docker defaults | ||
docker_edition: 'ce' | ||
docker_package_state: present | ||
docker_service_manage: false | ||
docker_install_compose_plugin: true | ||
docker_compose_package: docker-compose-plugin | ||
docker_compose_package_state: present | ||
|
||
docker_users: | ||
- "{{ lookup('env', 'USER') }}" | ||
roles: | ||
- role: setup-container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine | ||
{ | ||
"name": "${localWorkspaceFolderBasename}", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
"containerEnv": { | ||
"HOST_PROJECT_PATH": "${localWorkspaceFolder}", | ||
"PROJECT_NAME": "${localWorkspaceFolderBasename}", | ||
"PROJECT_PATH": "${containerWorkspaceFolder}", | ||
"FLASK_DEBUG": "True", | ||
"ANSIBLE_LOCALHOST_WARNING": "False", | ||
"ANSIBLE_INVENTORY_UNPARSED_WARNING": "False" | ||
}, | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"build": { | ||
"context": "..", | ||
"dockerfile": "../Dockerfile", | ||
"target": "devcontainer", | ||
"args": { | ||
"PROJECT_NAME": "${localWorkspaceFolderBasename}", | ||
"PROJECT_PATH": "${containerWorkspaceFolder}" | ||
} | ||
}, | ||
"initializeCommand": "touch ${localWorkspaceFolder}/.devcontainer/.env", | ||
"updateContentCommand": "make ansible", | ||
"runArgs": ["--name","${localWorkspaceFolderBasename}_devcontainer", "--hostname","${localWorkspaceFolderBasename}", "--env-file",".devcontainer/.env", "--gpus","all"], | ||
"mounts": [ | ||
"source=${localWorkspaceFolderBasename}-home,target=/home/anvil,type=volume", | ||
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/anvil/.ssh,type=bind,consistency=cached", | ||
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" | ||
], | ||
|
||
//Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"jeff-hykin.better-dockerfile-syntax", | ||
"ms-vsliveshare.vsliveshare", | ||
"mikestead.dotenv", | ||
"EditorConfig.EditorConfig", | ||
"redhat.vscode-yaml", | ||
"codeium.codeium", | ||
"ms-toolsai.jupyter", | ||
"streetsidesoftware.code-spell-checker", | ||
"eamodio.gitlens", | ||
"nhoizey.gremlins", | ||
"esbenp.prettier-vscode", | ||
"peakchen90.open-html-in-browser" | ||
], | ||
"settings": { | ||
"files.exclude": { | ||
"**/__pycache__": true, | ||
"**/.webassets-cache": true, | ||
"**/*.pyc": { | ||
"when": "$(basename).py" | ||
} | ||
}, | ||
"dev.containers.copyGitConfig": false, | ||
"dev.containers.gitCredentialHelperConfigLocation": "system", | ||
"files.readonlyFromPermissions": true, | ||
"python.analysis.extraPaths": [ "${containerWorkspaceFolder}/app" ], | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
app/feed_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for more information: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
# https://containers.dev/guide/dependabot | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "devcontainers" | ||
directory: "/" | ||
schedule: | ||
interval: weekly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# name: Build and Publish Docker Image | ||
|
||
# # This workflow uses actions that are not certified by GitHub. | ||
# # They are provided by a third-party and are governed by | ||
# # separate terms of service, privacy policy, and support | ||
# # documentation. | ||
|
||
# on: | ||
# workflow_dispatch: | ||
# push: | ||
# branches: [ "main" ] | ||
# # Publish semver tags as releases. | ||
# tags: [ 'v*.*.*' ] | ||
# paths: | ||
# - 'app/**/*' | ||
# - 'Dockerfile' | ||
# - 'requirements.txt' | ||
# - '.github/workflows/docker-publish.yml' | ||
# pull_request: | ||
# branches: [ "main" ] | ||
# types: [ closed ] | ||
# paths: | ||
# - 'app/**/*' | ||
# - 'Dockerfile' | ||
# - 'requirements.txt' | ||
# - '.github/workflows/docker-publish.yml' | ||
|
||
# env: | ||
# # Use docker.io for Docker Hub if empty | ||
# REGISTRY: ghcr.io | ||
# # github.repository as <account>/<repo> | ||
# IMAGE_NAME: ${{ github.repository }} | ||
|
||
|
||
# jobs: | ||
# build: | ||
|
||
# runs-on: ubuntu-latest | ||
# permissions: | ||
# contents: read | ||
# packages: write | ||
# # This is used to complete the identity challenge | ||
# # with sigstore/fulcio when running outside of PRs. | ||
# id-token: write | ||
|
||
# steps: | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v3 | ||
|
||
# # Set up BuildKit Docker container builder to be able to build | ||
# # multi-platform images and export cache | ||
# # https://github.com/docker/setup-buildx-action | ||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
|
||
# # Login against a Docker registry except on PR | ||
# # https://github.com/docker/login-action | ||
# - name: Log into registry ${{ env.REGISTRY }} | ||
# if: github.event_name != 'pull_request' | ||
# uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
# with: | ||
# registry: ${{ env.REGISTRY }} | ||
# username: ${{ github.actor }} | ||
# password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# - name: Docker meta | ||
# id: meta | ||
# uses: docker/metadata-action@v5 | ||
# with: | ||
# # list of Docker images to use as base name for tags | ||
# images: | | ||
# ghcr.io/${{ github.repository }} | ||
# # generate Docker tags based on the following events/attributes | ||
# tags: | | ||
# type=ref,event=branch | ||
# type=ref,event=pr | ||
# type=raw,value=latest,enable={{is_default_branch}} | ||
# type=sha | ||
|
||
# # Build and push Docker image with Buildx (don't push on PR) | ||
# # https://github.com/docker/build-push-action | ||
# - name: Build and push Docker image | ||
# id: build-and-push | ||
# uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | ||
# with: | ||
# context: . | ||
# target: production | ||
# push: ${{ github.event_name != 'pull_request' }} | ||
# tags: ${{ steps.meta.outputs.tags }} | ||
# labels: ${{ steps.meta.outputs.labels }} | ||
# cache-from: type=gha | ||
# cache-to: type=gha,mode=max | ||
|
||
# - name: Discord notification | ||
# env: | ||
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
# uses: rjstone/discord-webhook-notify@v1 | ||
# with: | ||
# severity: info | ||
# username: MafenBot | ||
# color: '#ff00aa' | ||
# avatarUrl: https://github.githubassets.com/images/modules/logos_page/Octocat.png | ||
# description: A new ${{ github.event.repository.name }} image ${{ steps.meta.outputs.tags }} has been published | ||
# details: Based on ${{ github.event.head_commit.url }} | ||
# footer: MafenBot became self aware | ||
# webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
|
||
{ | ||
"name": "Python Debugger: Flask", | ||
"type": "debugpy", | ||
"request": "launch", | ||
"module": "flask", | ||
"envFile": "${workspaceFolder}/.devcontainer/.env", | ||
"env": { | ||
"FLASK_APP": "app/app.py", | ||
"FLASK_DEBUG": "True", | ||
"FLASK_RUN_PORT": "9830", | ||
"FLASK_ENV": "development" | ||
}, | ||
"args": [ | ||
"run", | ||
"--debug" | ||
], | ||
"jinja": true, | ||
"autoStartBrowser": false | ||
} | ||
] | ||
} |
Oops, something went wrong.