Skip to content

Commit

Permalink
chore: devenv enhancements (#1000)
Browse files Browse the repository at this point in the history
Fix QOL aliases and allow multiple devenvs to run simultanously.
  • Loading branch information
lavarou authored Dec 19, 2024
1 parent 4393980 commit f14a128
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
13 changes: 0 additions & 13 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,26 @@ services:
MYSQL_USER: admin
MYSQL_PASSWORD: admin
MYSQL_HOST: mysqldb
ports:
- "3306:3306"
healthcheck:
test: ["CMD", "mysql", "--user=admin", "--password=admin", "-e", "SELECT 1"]
interval: 10s
timeout: 10s
retries: 3
start_period: 20s
container_name: mysqldb
volumes:
- var-run-mysqld:/var/run/mysqld
redisdb:
image: redis
restart: always
ports:
- "6379:6379"
container_name: redisdb
memcached:
image: memcached:latest
restart: always
ports:
- "11211:11211"
container_name: memcached
postgres:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: root
POSTGRES_USER: postgres
ports:
- "5432:5432"
container_name: postgres
php:
platform: ${PLATFORM:-}
image: newrelic/nr-php-agent-builder:make-php-${PHP:-8.2}-${LIBC:-gnu}-${IMAGE_VERSION:-v1}
Expand Down Expand Up @@ -106,7 +94,6 @@ services:
working_dir: /usr/src/myapp
stdin_open: true
tty: true
container_name: agent-devenv
profiles: ["dev"]

volumes:
Expand Down
14 changes: 8 additions & 6 deletions files/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,18 @@ ENV PHP_VER=${PHP_VER}
ARG PS1
ENV PS1="New Relic > "

# QOL aliases
# `rebuild` - make clean + make agent + make tests
# `integ` - run all integration tests
RUN echo 'alias integ="/usr/src/myapp/bin/integration_runner -agent /usr/src/myapp/agent/.libs/newrelic.so"' >> ~/.bashrc \
&& echo 'alias rebuild="make -C agent clean && rm agent/Makefile && make && make tests"' >> ~/.bashrc

ARG USER=developer
ARG UID=501
ARG GID=20
RUN useradd --uid ${UID} --gid ${GID} --shell /bin/bash --create-home ${USER}
USER ${USER}
# QOL aliases
# `rebuild` - make clean + make agent + make tests
# `integ` - run all integration tests
RUN echo 'alias integ="/usr/src/myapp/bin/integration_runner -agent /usr/src/myapp/agent/.libs/newrelic.so"' >> ~/.bashrc \
&& echo 'alias rebuild="make -C agent clean && rm agent/Makefile && make && make tests"' >> ~/.bashrc
WORKDIR /usr/src/myapp
# Avoid "fatal: detected dubious ownership in repository at '/usr/src/myapp/'" error
# when running git commands inside container with host volume mounted:
RUN git config --global --add safe.directory /usr/src/myapp/
CMD ["bash"]

0 comments on commit f14a128

Please sign in to comment.