Skip to content

Commit

Permalink
feat docker: add ubuntu-22.04-pg-dev image
Browse files Browse the repository at this point in the history
commit_hash:01f828bc761543e62cc2238d604a16ad5c05695e
  • Loading branch information
Anton3 committed Jan 22, 2025
1 parent 1246bab commit e3b0933
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish-ubuntu-22.04-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ jobs:
run: |
docker build -t ghcr.io/userver-framework/ubuntu-22.04-userver-pg:${USERVER_IMAGE_TAG} -f scripts/docker/ubuntu-22.04-pg.dockerfile .
docker push ghcr.io/userver-framework/ubuntu-22.04-userver-pg:${USERVER_IMAGE_TAG}
- name: Build the ubuntu-22.04-userver-pg-dev Docker image
run: |
docker build -t ghcr.io/userver-framework/ubuntu-22.04-userver-pg-dev:${USERVER_IMAGE_TAG} -f scripts/docker/ubuntu-22.04-pg-dev.dockerfile .
docker push ghcr.io/userver-framework/ubuntu-22.04-userver-pg-dev:${USERVER_IMAGE_TAG}
2 changes: 2 additions & 0 deletions .mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -3440,6 +3440,8 @@
"scripts/docker/pip-install.sh":"taxi/uservices/userver/scripts/docker/pip-install.sh",
"scripts/docker/run_as_user.sh":"taxi/uservices/userver/scripts/docker/run_as_user.sh",
"scripts/docker/setup-base-ubuntu-22.04-env.sh":"taxi/uservices/userver/scripts/docker/setup-base-ubuntu-22.04-env.sh",
"scripts/docker/setup-dev.sh":"taxi/uservices/userver/scripts/docker/setup-dev.sh",
"scripts/docker/ubuntu-22.04-pg-dev.dockerfile":"taxi/uservices/userver/scripts/docker/ubuntu-22.04-pg-dev.dockerfile",
"scripts/docker/ubuntu-22.04-pg.dockerfile":"taxi/uservices/userver/scripts/docker/ubuntu-22.04-pg.dockerfile",
"scripts/docker/ubuntu-22.04.dockerfile":"taxi/uservices/userver/scripts/docker/ubuntu-22.04.dockerfile",
"scripts/docs/README.md":"taxi/uservices/userver/scripts/docs/README.md",
Expand Down
36 changes: 36 additions & 0 deletions scripts/docker/setup-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Exit on any error and treat unset variables as errors, print all commands
set -euox pipefail

# Install a proper compilation toolchain
apt update
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
clang-18 \
lld-18 \
llvm-18 \
clangd-18 \
clang-format-18 \
clang-tidy-18 \
libclang-rt-18-dev
apt clean all

# Prefer clang-18 toolchain by default
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
update-alternatives --install /usr/bin/lld lld /usr/bin/lld-18 100
update-alternatives --install /usr/bin/ld ld /usr/bin/lld 100
update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-18 100
update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-18 100
update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-18 100

# Create user "user" for non-root access to services in devcontainer
USERNAME=user
USER_UID=1000
USER_GID=$USER_UID
groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
6 changes: 6 additions & 0 deletions scripts/docker/ubuntu-22.04-pg-dev.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ghcr.io/userver-framework/ubuntu-22.04-userver-pg:latest

COPY scripts/docker/setup-dev.sh /userver_tmp/
RUN /userver_tmp/setup-dev.sh && rm -rf /userver_tmp

EXPOSE 8080-8100

0 comments on commit e3b0933

Please sign in to comment.