Skip to content

Instantly share code, notes, and snippets.

@yeisoncruz16
Last active October 8, 2020 17:14
Show Gist options
  • Save yeisoncruz16/338154ce1196ff95998a1a749b61bedf to your computer and use it in GitHub Desktop.
Save yeisoncruz16/338154ce1196ff95998a1a749b61bedf to your computer and use it in GitHub Desktop.
Dockerfile to run PHP & NodeJs with serverless installed (useful for CI/CD)
FROM thecodingmachine/php:7.4-v3-cli-node10
LABEL authors="Julien Neuhart <j.neuhart@thecodingmachine.com>, David Négrier <d.negrier@thecodingmachine.com>"
USER root
RUN apt-get update && \
apt-get install -y --no-install-recommends gnupg && \
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
apt-get update && \
apt-get install -y --no-install-recommends nodejs && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install -y --no-install-recommends yarn && \
npm install -g npm
RUN npm install -g serverless
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
USER docker
image: your-docker-registry-image
cache:
paths:
- node_modules/
stages:
- build
- deploy
build:
stage: build
script:
- composer update
- npm install
artifacts:
untracked: true
Production:
stage: deploy
dependencies:
- build
script:
- serverless deploy --stage prod --verbose
environment: Production
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment