Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile and devcontainer for pulumi/python #1834

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 36 additions & 17 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
ARG VARIANT=3.10
FROM python:${VARIANT}-buster

# Set package versions
ARG AZURE_CLI_VERSION="2.42.0"
ARG PULUMI_VERSION="3.80.0"
ARG VARIANT=3.12
ARG DISTRIBUTION="bookworm"
FROM python:${VARIANT}-${DISTRIBUTION}

RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
git \
libssl-dev \
python3-sphinx

# Set up TARGETARCH variable to use to pull the right binaries
# for the current architecture.
ARG TARGETARCH
git \
libssl-dev \
python3-sphinx

# Install Azure-CLI
# Standard install method currently does not support ARM64
# Use pip instead - https://github.com/Azure/azure-cli/issues/22875
RUN pip3 install azure-cli==${AZURE_CLI_VERSION}
RUN pip3 install hatch
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
RUN mkdir -p /etc/apt/keyrings \
&& curl -sLS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /etc/apt/keyrings/microsoft.gpg \
&& chmod go+r /etc/apt/keyrings/microsoft.gpg

# Set package versions
ARG AZURE_CLI_VERSION="2.59.0"
ARG DISTRIBUTION

# Add the Azure CLI repository
RUN cat <<EOF > /etc/apt/sources.list.d/azure-cli.sources
Types: deb
URIs: https://packages.microsoft.com/repos/azure-cli/
Suites: $(lsb_release -cs)
Components: main
Architectures: $(dpkg --print-architecture)
Signed-by: /etc/apt/keyrings/microsoft.gpg
EOF

RUN apt-get update \
&& apt-get -y install azure-cli=${AZURE_CLI_VERSION}-1~${DISTRIBUTION}

# Create non-root user and give them sudo access
ARG USERNAME=deploydsh
Expand All @@ -42,3 +58,6 @@ RUN pip3 install -r /build/requirements.txt

# Set PATH for pulumi - pulumi installed as feature to work round installing as root
ENV PATH=$PATH:/home/${USERNAME}/.pulumi/bin

# Install hatch to build the dsh cli tool
RUN pip3 install hatch
7 changes: 3 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@
{
"name": "Turing Data Safe Haven - Pulumi",
craddm marked this conversation as resolved.
Show resolved Hide resolved
"build": {
"context": "../..",
"context": "..",
"dockerfile": "Dockerfile"
},
"settings": {
"terminal.integrated.defaultProfile.linux": "bash"
},
"extensions": [
"github.vscode-pull-request-github",
"ms-vscode.powershell",
"ms-vscode.azure-account",
"ms-python.python",
"christian-kohler.path-intellisense"
],
"remoteUser": "deploydsh",
"features": {
"ghcr.io/devcontainers-contrib/features/pulumi:1": {
"version": "3.80.0",
"bashCompletion": false
"version": "latest",
"bashCompletion": true
}
}
}