-
-
Save JorgenEvens/565f0c6d3591d249bcc5bf9cbbc8f785 to your computer and use it in GitHub Desktop.
Dockerizing our Heroku apps
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
ARG STACK_VERSION=20 | |
FROM gliderlabs/herokuish:latest-${STACK_VERSION} AS build | |
COPY . /tmp/app | |
ARG NPM_TOKEN | |
ENV NODE_ENV=production | |
RUN (cat /tmp/app/app.json || echo '{}') | jq -r '.buildpacks[].url' > /tmp/app/.buildpacks && \ | |
(test -s /tmp/app/.buildpacks || rm /tmp/app/.buildpacks) | |
RUN /build && \ | |
rm -Rf /tmp/* && \ | |
rm -Rf /app/.npmrc | |
RUN herokuish slug generate && \ | |
herokuish slug export > /app.tar.gz | |
FROM gliderlabs/herokuish:latest-${STACK_VERSION} | |
ENV PORT 3000 | |
ENV NODE_ENV=production | |
COPY --from=0 /etc /etc | |
RUN --mount=type=bind,from=build,source=/app.tar.gz,target=/app.tar.gz \ | |
herokuish slug import < /app.tar.gz | |
ENTRYPOINT [ "/start" ] | |
CMD [ "web" ] |
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
APP_NAME?=some-app | |
APP_NAMESPACE?=default | |
IMAGE_NAME?="ambassify/$(APP_NAME)" | |
export DOCKER_BUILDKIT = 1 | |
up: build | |
docker run -t -i \ | |
-e PORT=3000 \ | |
-p 3000:3000/tcp \ | |
$(IMAGE_NAME) | |
pull: | |
docker pull gliderlabs/herokuish | |
build: pull | |
docker build --build-arg NPM_TOKEN -t $(IMAGE_NAME) . | |
debug: build | |
docker run -t -i --entrypoint /bin/bash $(IMAGE_NAME) | |
publish: build | |
docker tag $(IMAGE_NAME) ghcr.io/$(IMAGE_NAME) | |
docker push ghcr.io/$(IMAGE_NAME) | |
deploy: publish | |
kubectl rollout restart deployment $(APP_NAME) -n $(APP_NAMESPACE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment