Skip to content

Commit

Permalink
Devcontainer setup
Browse files Browse the repository at this point in the history
  • Loading branch information
neilmiddleton committed Dec 19, 2024
1 parent f96cd3e commit d37a204
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
ARG RUBY_VERSION=3.3.6
FROM ruby:$RUBY_VERSION-alpine3.20

RUN apk add --update build-base docker gcompat git gpg postgresql-dev postgresql-client pre-commit python3 openssh shared-mime-info tzdata gnupg
19 changes: 19 additions & 0 deletions .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "trade_tariff_frontend"

services:
rails:
build:
context: ..
dockerfile: .devcontainer/Dockerfile

volumes:
- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Uncomment the next line to use a non-root user for all processes.
# user: vscode

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// For format details, see https://containers.dev/implementors/json_reference/.
// For config options, see the README at: https://github.com/devcontainers/templates/tree/main/src/ruby
{
"name": "trade_tariff_frontend",
"dockerComposeFile": "compose.yaml",
"service": "rails",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/cirolosapio/devcontainers-features/alpine-ohmyzsh:0": {},
// "ghcr.io/gvatsal60/dev-container-features/pre-commit:1": {}
},
"containerEnv": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
3001
],
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://containers.dev/implementors/json_reference/#remoteUser.
// "remoteUser": "root",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bin/bundle install",
"postStartCommand": "bin/dev"
}
6 changes: 3 additions & 3 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ALLOW_SEARCH=true
API_SERVICE_BACKEND_URL_OPTIONS={"uk":"http://localhost:3000","xi":"http://localhost:3000"}
API_SERVICE_BACKEND_URL_OPTIONS={"uk":"http://host.docker.internal:3000","xi":"http://host.docker.internal:3000"}
AWS_ACCESS_KEY_ID=aws_access_key_id
AWS_BUCKET_NAME=trade-tariff-frontend
AWS_REGION=us-east-1
Expand All @@ -11,8 +11,8 @@ BETA_SEARCH_HEADING_STATISTICS_THRESHOLD=3
BETA_SEARCH_FACET_FILTER_DISPLAY_PERCENTAGE_THRESHOLD=5
BETA_SEARCH_SWITCHING_ENABLED=true
DUTY_CALCULATOR=true
DUTY_CALCULATOR_BASE_URL=http://localhost:3002/duty-calculator
FRONTEND_HOST=http://localhost
DUTY_CALCULATOR_BASE_URL=http://host.docker.internal:3002/duty-calculator
FRONTEND_HOST=http://host.docker.internal
GREEN_LANES_ENABLED=true
GOOGLE_TAG_MANAGER_CONTAINER_ID=GTM-XXXXXXX
HTTPARTY_READ_TIMEOUT=661
Expand Down
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ALLOW_SEARCH=true
API_SERVICE_BACKEND_URL_OPTIONS={"uk":"http://localhost:3018","xi":"http://localhost:3019" }
API_SERVICE_BACKEND_URL_OPTIONS={"uk":"http://host.docker.internal:3018","xi":"http://host.docker.internal:3019" }
AWS_ACCESS_KEY_ID=aws_access_key_id
AWS_BUCKET_NAME=trade-tariff-frontend
AWS_REGION=us-east-1
Expand Down
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,17 @@ GEM
concurrent-ruby (~> 1.1)
webrick (~> 1.7)
websocket-driver (>= 0.6, < 0.8)
ffi (1.17.0-aarch64-linux-musl)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
forgery (0.8.1)
formatador (1.1.0)
globalid (1.2.1)
activesupport (>= 6.1)
google-protobuf (4.27.5-aarch64-linux)
bigdecimal
rake (>= 13)
google-protobuf (4.27.5-arm64-darwin)
bigdecimal
rake (>= 13)
Expand Down Expand Up @@ -342,6 +346,8 @@ GEM
net-protocol
newrelic_rpm (9.16.0)
nio4r (2.7.3)
nokogiri (1.16.8-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.8-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.8-x86_64-darwin)
Expand Down Expand Up @@ -774,6 +780,7 @@ GEM
zeitwerk (2.6.18)

PLATFORMS
aarch64-linux-musl
arm64-darwin-23
arm64-darwin-24
x86_64-darwin-22
Expand Down

0 comments on commit d37a204

Please sign in to comment.