Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerize Rover #1066

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ jobs:
- compute_checksums
- gh_release
- npm_publish
- docker_release

# reusable command snippets can be referred to in any `steps` object
commands:
Expand Down Expand Up @@ -492,3 +493,38 @@ commands:
- run:
name: Publish to npm (beta)
command: cd << parameters.npm_dir >> && npm publish --tag beta << parameters.options >>

docker_release:
steps:
- unless:
condition: << pipeline.git.tag >>
steps:
- exec_docker_release:
options: ""
release_tag: << pipeline.git.branch >>
- when:
condition: << pipeline.git.tag >>
steps:
- exec_docker_release

exec_docker_release:
parameters:
options:
type: string
default: ""
release_tag:
type: string
default: << pipeline.git.tag >>
rover_tag:
type: string
default: ghcr.io/apollographql/rover
steps:
- run:
name: Build image
command: docker build --build-arg ROVER_RELEASE=<< parameters.release_tag >> -f dockerfiles/Dockerfile.rover -t << parameters.rover_tag >>:<< parameters.release_tag >> .
- run:
name: Login
command: echo ${GITHUB_DOCKER_TOKEN} | docker login ghcr.io -u garypen --password-stdin
- run:
name: Push image
command: docker push << parameters.rover_tag >>:<< parameters.release_tag >>
33 changes: 33 additions & 0 deletions dockerfiles/Dockerfile.rover
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Build is required to extract the release files
FROM --platform=linux/amd64 alpine:latest AS build

# Rover release version
ARG ROVER_RELEASE

# Install packages
RUN apk add zlib-dev musl-dev

# Pull rover release from GH
ADD https://github.com/apollographql/rover/releases/download/v${ROVER_RELEASE}/rover-v${ROVER_RELEASE}-x86_64-unknown-linux-gnu.tar.gz /tmp/rover.tar.gz

WORKDIR /tmp

# rover.tar.gz extracts to "dist"
RUN tar xvzf rover.tar.gz -C /

# Final image uses distroless
FROM --platform=linux/amd64 gcr.io/distroless/cc-debian11

LABEL org.opencontainers.image.authors="ApolloGraphQL https://github.com/apollographql/rover"

# Copy required shared libraries
COPY --from=build /lib/libz.so.1 /lib/x86_64-linux-gnu/
COPY --from=build /lib/libc.musl-x86_64.so.1 /lib/x86_64-linux-gnu/

# Copy in the extracted/created files
COPY --from=build --chown=root:root /dist /dist

WORKDIR /dist

# Default executable is the rover
ENTRYPOINT ["./rover"]