-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitpod.Dockerfile
97 lines (76 loc) · 2.9 KB
/
.gitpod.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Use another python version in Gitpod Workspace
# Reference: https://www.gitpod.io/docs/configure/workspaces/workspace-image
# Reference 2: https://simonemms.com/blog/2022/04/30/using-a-non-ubuntu-base-image-in-gitpod
# Reference 3: https://github.com/gitpod-io/gitpod/issues/7459
# Reference 4: Install chrome broswer on Docker to use Selenium https://github.com/omkarcloud/gitpod-selenium
# Reference 5: Install VNC on gitpod https://gist.github.com/nadvolod/73997a12e646e5c00bafb1b9c12fd7b1
# could use workspace-full and delete Part 2 if you don't need UI interface for Chrome browser
FROM gitpod/workspace-full-vnc
# Part 1: Set up AWS Cloud Development Kit
USER root
## use python 3.10
RUN pyenv install 3.10 \
&& pyenv global 3.10
## Install necessary packages
RUN sudo install-packages \
python3-pip \
nodejs \
npm \
git \
git-lfs \
curl \
zip \
unzip
## Install AWS CLI v2
### refer https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& sudo ./aws/install -i /usr/local/aws-cli -b /usr/local/bin \
&& rm -rf awscliv2.zip \
&& rm -rf ./aws
## Install AWS CDK and aws-cdk-lib module
RUN npm install -g aws-cdk
## Copy the requirements file into the container
COPY requirements.txt .
## Install Python dependencies from requirements.txt
RUN pip3 install -r requirements.txt
# Part 2: install depencies for VNC
RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && \
sdk install java 17.0.3-ms && \
sdk default java 17.0.3-ms"
RUN sudo apt-get update \
&& sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
libgtk2.0-0 \
libgtk-3-0 \
libnotify-dev \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libxtst6 \
xauth \
xvfb \
&& sudo rm -rf /var/lib/apt/lists/*
### update python pip package tool
RUN python -m pip install --upgrade pip
# Part 3: Install Chrome browser on Docker, as it's required by Selenium
# refer https://github.com/omkarcloud/gitpod-selenium/blob/master/Dockerfile
## Install Chrome dependencies
RUN apt-get update && apt-get install -y \
wget \
gnupg2 \
apt-transport-https \
ca-certificates \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*
# Add the Google Chrome repository
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
# Install Google Chrome
RUN apt-get update && apt-get install -y google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*
USER gitpod
# Add the Chrome as a path variable
ENV CHROME_BIN=/usr/bin/google-chrome
# Check if Chrome was installed successfully
RUN google-chrome --version