-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from hadirgax/feat/add-python-devcontainer
added python devcontainer
- Loading branch information
Showing
5 changed files
with
137 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Build Python Bookworm Devcontainer Image | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'devcontainer_images/src/python/Dockerfile' | ||
- '.github/workflows/python_ci.yml' | ||
pull_request: | ||
paths: | ||
- 'devcontainer_images/src/python/Dockerfile' | ||
- '.github/workflows/python_ci.yml' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/[email protected] | ||
with: | ||
platforms: linux/amd64 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/[email protected] | ||
with: | ||
version: latest | ||
driver-opts: network=host | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: hadirgax/devcontainer-python | ||
tags: | | ||
type=ref,event=branch | ||
- name: build python | ||
uses: docker/[email protected] | ||
with: | ||
context: ./devcontainer_images/src/python | ||
builder: ${{ steps.buildx.outputs.name }} | ||
file: ./devcontainer_images/src/python/Dockerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64 | ||
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# [Choice] Python version from https://hub.docker.com/_/python | ||
FROM python:3.12-slim-bookworm | ||
|
||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONFAULTHANDLER 1 | ||
|
||
# hadolint ignore=DL3008 | ||
RUN set -eux; \ | ||
apt-get update -q && \ | ||
apt-get install -q -y --no-install-recommends \ | ||
bzip2 \ | ||
build-essential \ | ||
ca-certificates \ | ||
curl \ | ||
gettext \ | ||
gnupg \ | ||
libcurl?-openssl-dev \ | ||
libexpat1-dev \ | ||
libfontconfig1 \ | ||
libglib2.0-0 \ | ||
libpcre2-dev \ | ||
libsm6 \ | ||
libssl-dev \ | ||
libxext6 \ | ||
libxrender1 \ | ||
netbase \ | ||
openssh-client \ | ||
procps \ | ||
p7zip-full \ | ||
subversion \ | ||
sudo \ | ||
tar \ | ||
wget \ | ||
zip \ | ||
zlib1g-dev \ | ||
zsh \ | ||
&& apt-get upgrade -yq \ | ||
&& update-ca-certificates \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ARG GIT_VERSION=2.44.0 | ||
RUN curl -sL https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz | tar -xzC /tmp 2>&1 && \ | ||
cd /tmp/git-${GIT_VERSION} && \ | ||
make -s USE_LIBPCRE=YesPlease prefix=/usr/local sysconfdir=/etc all && \ | ||
make -s USE_LIBPCRE=YesPlease prefix=/usr/local sysconfdir=/etc install 2>&1 && \ | ||
rm -rf /tmp/git-${GIT_VERSION} && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
ARG USERNAME=devcon | ||
ARG USER_GID=1000 | ||
ARG USER_HOME="/home/${USERNAME}" | ||
RUN groupadd --gid ${USER_GID} ${USERNAME} && \ | ||
useradd -s /bin/bash --gid ${USER_GID} -m ${USERNAME} && \ | ||
echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} && \ | ||
chmod 0440 /etc/sudoers.d/${USERNAME} | ||
|
||
RUN OMZ_DIR=${USER_HOME}/.oh-my-zsh && \ | ||
umask g-w,o-w && \ | ||
mkdir -p "${OMZ_DIR}" && \ | ||
git clone --depth=1 \ | ||
-c core.eol=lf \ | ||
-c core.autocrlf=false \ | ||
-c fsck.zeroPaddedFilemode=ignore \ | ||
-c fetch.fsck.zeroPaddedFilemode=ignore \ | ||
-c receive.fsck.zeroPaddedFilemode=ignore \ | ||
"https://github.com/ohmyzsh/ohmyzsh" "${OMZ_DIR}" 2>&1 && \ | ||
ZSHRC_TEMPLATE_FILE="${OMZ_DIR}/templates/zshrc.zsh-template" && \ | ||
echo "$(cat "${ZSHRC_TEMPLATE_FILE}")\nDISABLE_AUTO_UPDATE=false\nDISABLE_UPDATE_PROMPT=false" > ${USER_HOME}/.zshrc && \ | ||
cd ${OMZ_DIR} && \ | ||
git repack -a -d -f --depth=1 --window=1 && \ | ||
echo "auth sufficient pam_rootok.so" >> /etc/pam.d/chsh && \ | ||
chsh --shell /bin/zsh ${USERNAME} && \ | ||
chown -R ${USER_GID}:${USERNAME} ${USER_HOME}/.zshrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# The [@hadirgax](https://github.com/hadirgax) VSCode Extension Pack | ||
|
||
This is the extension pack that includes all the extensions I use daily. |