before redoing devcontainer files

This commit is contained in:
Dylan Knutson
2024-12-17 06:34:47 -08:00
parent 752b8c3b2c
commit aad2f29e96
36 changed files with 9857 additions and 826 deletions

9
.devcontainer/.env Normal file
View File

@@ -0,0 +1,9 @@
PGADMIN_DEFAULT_EMAIL=admin@example.com
PGADMIN_DEFAULT_PASSWORD=password
PGADMIN_LISTEN_PORT=8080
# no password required
PGADMIN_CONFIG_SERVER_MODE=False
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False
RAILS_ENV=development
NODE_ENV=development

View File

@@ -0,0 +1,68 @@
FROM ruby:3.2.0 AS native-gems
RUN rm -f /etc/apt/apt.conf.d/docker-clean; \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get install --no-install-recommends --no-install-suggests -y \
cmake
WORKDIR /usr/src/app
RUN gem install bundler -v '2.4.5'
COPY gems gems
WORKDIR /usr/src/app/gems/xdiff-rb
RUN bundle install
RUN rake compile
WORKDIR /usr/src/app/gems/rb-bsdiff
RUN bundle install
RUN rake compile
# Primary image
FROM mcr.microsoft.com/devcontainers/base:bookworm
# apt caching & install packages
RUN rm -f /etc/apt/apt.conf.d/docker-clean; \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get install --no-install-recommends --no-install-suggests -y \
autoconf \
build-essential \
ca-certificates \
curl \
gnupg \
libblas-dev \
libdb-dev \
libffi-dev \
libgdbm-dev \
libgdbm6 \
libgmp-dev \
liblapack-dev \
libncurses5-dev \
libpq-dev \
libreadline6-dev \
libssl-dev \
libvips42 \
libyaml-dev \
patch \
rbenv \
rustc \
uuid-dev \
zlib1g-dev
USER vscode
ENV PATH=/home/vscode/.rbenv/shims:$PATH
ENV CONFIGURE_OPTS="--disable-install-rdoc"
RUN git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
RUN rbenv install 3.2.0
RUN rbenv global 3.2.0
COPY --from=native-gems /usr/src/app/gems/xdiff-rb /gems/xdiff-rb
COPY --from=native-gems /usr/src/app/gems/rb-bsdiff /gems/rb-bsdiff
ENV RAILS_ENV development
ENV RUBOCOP_OPTS --server

View File

@@ -0,0 +1,42 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Redux Scraper",
// "build": {
// // Sets the run context to one level up instead of the .devcontainer folder.
// "context": "..",
// // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
// "dockerfile": "Dockerfile"
// },
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// "mounts": [
// {
// "type": "volume",
// "source": "${devcontainerId}-gems",
// "target": "/home/vscode/.rbenv/versions/3.2.0/lib/ruby/gems"
// }
// ],
"features": {
"ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {},
"ghcr.io/nikobockerman/devcontainer-features/fish-persistent-data:2": {},
"ghcr.io/devcontainers/features/node:1": {
"installYarnUsingApt": true,
"version": "18",
"pnpmVersion": "none",
"nvmVersion": "latest"
}
},
// "runArgs": [
// "--network=host"
// ],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "${containerWorkspaceFolder}/.devcontainer/post-create.sh"
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}

View File

@@ -0,0 +1,33 @@
version: '3.8'
volumes:
devcontainer-redux-postgres-data:
devcontainer-redux-gem-cache:
services:
app:
build:
context: ..
dockerfile: Dockerfile.devcontainer
volumes:
# - ../..:/workspaces:cached
- devcontainer-redux-gem-cache:/home/vscode/.rbenv/versions/3.2.0/lib/ruby/gems
command: sleep infinity
network_mode: service:db
env_file:
- .env
db:
image: pgvector/pgvector:pg17
restart: unless-stopped
volumes:
- devcontainer-redux-postgres-data:/var/lib/postgresql/data
env_file:
- .env
pgadmin:
image: dpage/pgadmin4:8.13.0
restart: unless-stopped
network_mode: service:db
env_file:
- .env

19
.devcontainer/post-create.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash -ex
echo "Path: $PATH"
echo "Ruby: $(which ruby)"
echo "Gem: $(which gem)"
echo "Bundler: $(which bundler)"
echo "Rake: $(which rake)"
gem install bundler -v '2.4.1'
gem install rake -v '13.0.6'
gem install ruby-lsp -v '0.22.1'
gem install rubocop -v '1.69.2'
bundle install --jobs $(getconf _NPROCESSORS_ONLN)
rbenv rehash
rubocop --start-server
npm install yarn
bin/rails yarn:install
yarn