Skip to content

Commit

Permalink
feat: first iteration, untested
Browse files Browse the repository at this point in the history
  • Loading branch information
bkataru committed Sep 29, 2024
1 parent 8ab6f57 commit 093d3e2
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM mcr.microsoft.com/devcontainers/rust:1-1-bullseye

# refresh
RUN apt update -y && apt upgrade -y

# refresh rust toolchain
RUN rustup self update

WORKDIR /workspace
COPY .. .

USER root
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "rust-environment",
"dockerComposeFile": ["docker-compose.yml"],

"service": "rust-impulse",
"runServices": ["rust-impulse"],
"shutdownAction": "stopCompose",

"workspaceFolder": "/workspace",
"postCreateCommand": "chmod +x /workspace/.devcontainer/post-create.sh && /workspace/.devcontainer/post-create.sh",
"overrideCommand": true,
"remoteUser": "root",

"customizations": {
"vscode": {
"extensions": [
"fill-labs.dependi",
"tamasfe.even-better-toml",
"dustypomerleau.rust-syntax",
"rust-lang.rust-analyzer"
]
}
}
}
22 changes: 22 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

services:
rust-impulse:
image: bkataru/impulses:rust-generic
container_name: rust-impulse-container
build:
context: .
dockerfile: ./Dockerfile
volumes:
- ../:/workspace
- ~/.ssh:/home/vscode/.ssh:ro
- ~/.ssh:/root/.ssh:ro
- /var/run/docker.sock:/var/run/docker.sock
environment:
- TZ=
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined
tty: true
stdin_open: true
command: "/bin/bash"
5 changes: 5 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

cd /workspace

echo "impulse ready.."
28 changes: 28 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
name: main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: repo-basename
run: |
echo "value=`basename ${{ github.repository }}`" >> $GITHUB_OUTPUT
shell: bash
- name: Docker login
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- name: Build the Docker image
run: docker build -t bkataru/impulses:${{ steps.repo-basename.outputs.value }} .devcontainer/
- name: Push the Docker image
run: docker push bkataru/impulses:${{ steps.repo-basename.outputs.value }}
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"fill-labs.dependi",
"tamasfe.even-better-toml",
"dustypomerleau.rust-syntax",
"rust-lang.rust-analyzer"
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.wordWrap": "on",
}

0 comments on commit 093d3e2

Please sign in to comment.