forked from barryvdh/laravel-dompdf
-
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 #2 from upmind/dev-env
Dev env
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Base image with PHP 7.4 | ||
FROM php:7.4-cli | ||
|
||
# Arguments to capture UID and GID | ||
ARG HOSTUID | ||
ARG HOSTGID | ||
|
||
# Install Composer | ||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer | ||
|
||
# Install necessary tools | ||
RUN apt-get update && apt-get install -y \ | ||
sudo \ | ||
git \ | ||
unzip \ | ||
&& apt-get clean | ||
|
||
# Create a group and user with matching UID/GID | ||
RUN groupadd -g ${HOSTGID} developer \ | ||
&& useradd -m -u ${HOSTUID} -g ${HOSTGID} -s /bin/bash developer \ | ||
&& usermod -aG sudo developer \ | ||
&& echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
||
# Set permissions for the working directory | ||
WORKDIR /app | ||
RUN chown -R developer:developer /app | ||
|
||
# Switch to the new user | ||
USER developer | ||
|
||
# Default shell command | ||
CMD ["/bin/bash"] |
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,15 @@ | ||
|
||
services: | ||
php: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
args: | ||
HOSTUID: "${HOSTUID:-1001}" | ||
HOSTGID: "${HOSTGID:-1001}" | ||
container_name: php74-dev | ||
volumes: | ||
- .:/app | ||
working_dir: /app | ||
tty: true | ||
stdin_open: true |