Skip to content

Instantly share code, notes, and snippets.

@aryadiahmad4689
Last active May 24, 2022 00:34
Show Gist options
  • Save aryadiahmad4689/fce6c50269f6a1b55839a5a97f3193d3 to your computer and use it in GitHub Desktop.
Save aryadiahmad4689/fce6c50269f6a1b55839a5a97f3193d3 to your computer and use it in GitHub Desktop.
FROM php:7.3-cli-alpine
# envirotmen variable
ENV \
APP_DIR="/app" \
APP_PORT="8001"
# memindahkan file atau folder ke direktori yang di inginkan di docker
COPY . $APP_DIR
COPY .env.example $APP_DIR/.env
# menginstall kebutuhan yang ingin kita gunakan
RUN apk add --update \
curl \
php \
php-opcache \
php-openssl \
php-pdo \
php-json \
php-phar \
php-dom \
&& rm -rf /var/cache/apk/*
# menginstall composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/bin --filename=composer
# menjalankan perintah composer
RUN cd $APP_DIR && composer update
RUN cd $APP_DIR && php artisan key:generate
# entrypoint
WORKDIR $APP_DIR
#
CMD php artisan serve --host=0.0.0.0 --port=$APP_PORT
# akses port yang dibuka
EXPOSE $APP_PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment