Skip to content

Instantly share code, notes, and snippets.

@trejo08
Created February 13, 2020 14:51
Show Gist options
  • Save trejo08/8115221b5f412372c458600354d69b68 to your computer and use it in GitHub Desktop.
Save trejo08/8115221b5f412372c458600354d69b68 to your computer and use it in GitHub Desktop.
example of multi-stages using two different images to relase a final
FROM golang:1.12-alpine AS gobuild
RUN apk update && apk add --no-cache gcc g++ make git
COPY ./ /build
WORKDIR /build
RUN GOOS=linux GOAR=amd64 go build -o binary
FROM jrottenberg/ffmpeg AS base-build
ENV PYENV_ROOT=/root/.pyenv
ENV PATH=$PYENV_ROOT/bin:$PATH
ENV PATH=$PYENV_ROOT/shims:$PATH
ENV PATH=$PYENV_ROOT/versions/3.7.4/bin:$PATH
RUN apt update && apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
RUN curl https://pyenv.run | bash
RUN exec $SHELL
RUN pyenv install 3.7.4
RUN git clone https://github.com/ytdl-org/youtube-dl.git && \
cd youtube-dl && \
python3 setup.py install
FROM base-build AS release
COPY --from=gobuild /build/. /app/
ENV APP_PORT=9040
ENV ALLOWEDDOMAINS=*
ENV APP_LANG=en-US
ENV LOGGERSETLEVEL=1
ENV GOOGLE_CLOUD_PROJECT=my-google-project
ENV GOOGLE_APPLICATION_CREDENTIALS=./google-service-account.json
ENV STORAGE_BUCKET_NAME=bucket-name
ENV STORAGE_BUCKET_THUMBNAILS=bucket-thumbnails
ENV PUBSUB_TOPIC=topic
ENV PUBSUB_SUBSCRIPTION=subscription-dev
WORKDIR /app
RUN pwd
RUN ls -l
RUN ls -l /app
ENTRYPOINT /app/binary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment