Skip to content

Commit 8f338d2

Browse files
committed
chore: add AWS dev tools to the dev container
download installers directly from AWS to ensure we use the latest version
1 parent 81d3d56 commit 8f338d2

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,22 @@ RUN pip install --no-cache-dir -r docs/requirements.txt
1010

1111
# install streamlit requirements
1212
RUN pip install --no-cache-dir -r streamlit_app/requirements.txt
13+
14+
# install AWS CLI and Copilot CLI
15+
USER root
16+
# download AWS CLIs to /tmp to avoid write error (23) from curl command
17+
WORKDIR /tmp
18+
19+
ARG HOST_ARCH
20+
RUN if [ "$HOST_ARCH" = "amd64" ]; then \
21+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"; \
22+
elif [ "$HOST_ARCH" = "arm64" ]; then \
23+
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"; \
24+
fi \
25+
&& unzip awscliv2.zip \
26+
&& ./aws/install \
27+
&& rm -rf aws awscliv2.zip
28+
29+
RUN curl -Lo copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux \
30+
&& chmod +x copilot \
31+
&& mv copilot /usr/local/bin/copilot

bin/build.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
#!/usr/bin/env bash
22
set -eux
33

4+
# Get host architecture for dev container
5+
ARCH=$(uname -m)
6+
# Normalize architecture
7+
case "$ARCH" in
8+
x86_64) ARCH="amd64" ;;
9+
aarch64) ARCH="arm64" ;;
10+
esac
11+
412
docker compose build app
513

6-
docker compose build dev
14+
HOST_ARCH=$ARCH docker compose build dev
715

816
docker compose build streamlit

compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ services:
1414
build:
1515
context: .
1616
dockerfile: .devcontainer/Dockerfile
17+
args:
18+
HOST_ARCH: ${HOST_ARCH}
1719
image: caltrans/pems:dev
1820
env_file: .env
1921
# https://code.visualstudio.com/docs/remote/create-dev-container#_use-docker-compose

0 commit comments

Comments
 (0)