Skip to content

Commit adbe771

Browse files
committed
base working + docker compose up functions locally
1 parent e7a1025 commit adbe771

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Note: You can use any Debian/Ubuntu based image you want.
22
FROM mcr.microsoft.com/vscode/devcontainers/base:bullseye
33

4+
# root acess for beginning of the script
5+
USER root
6+
47
# [Option] Install zsh
58
ARG INSTALL_ZSH="true"
69
# [Option] Upgrade OS packages to their latest versions
@@ -23,9 +26,18 @@ RUN apt-get update \
2326
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
2427
# Use Docker script from script library to set things up
2528
&& /bin/bash /tmp/library-scripts/docker-debian.sh "${ENABLE_NONROOT_DOCKER}" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}" \
29+
# Create the baseuser user and group
30+
&& groupadd -r baseuser && useradd -r -g baseuser baseuser \
2631
# Clean up
2732
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/
2833

34+
# Create directories for Elasticsearch and add necessary permissions
35+
RUN mkdir -p /usr/share/elasticsearch /var/lib/elasticsearch /var/log/elasticsearch \
36+
&& chown -R baseuser:baseuser /usr/share/elasticsearch /var/lib/elasticsearch /var/log/elasticsearch
37+
38+
# Switch back to the baseuser
39+
USER baseuser
40+
2941
# Setup the app here
3042

3143
# Setting the ENTRYPOINT to docker-init.sh will configure non-root access
@@ -35,4 +47,4 @@ CMD [ "sleep", "infinity" ]
3547

3648
# [Optional] Uncomment this section to install additional OS packages.
3749
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
38-
# && apt-get -y install --no-install-recommends <your-package-list-here>
50+
# && apt-get -y install --no-install-recommends <your-package-list-here>

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ services:
1515
- "127.0.0.1:5432:5432"
1616
elasticsearch:
1717
image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0
18+
user: root
1819
volumes:
1920
- es-data:/usr/share/elasticsearch/data
2021
- es-logs:/var/log

0 commit comments

Comments
 (0)