Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
Merged
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
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
Dockerfile
.licenses
.ghc.environment.x86_64-darwin-8.6.5

/bin
/dist-newstyle
/notices
/docs
20 changes: 8 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
FROM haskell:8.6 as build
WORKDIR /build
RUN cabal new-update

# Build our upstream dependencies after copying in only enough to tell cabal
# what they are. This will make these layers cache better even as we change the
# code of semantic itself.
# Build and cache the dependencies first so we can cache these layers.
COPY semantic.cabal .
COPY cabal.project .
COPY semantic-core/semantic-core.cabal ./semantic-core/
COPY vendor ./vendor
COPY semantic-core semantic-core
RUN cabal new-update hackage.haskell.org,HEAD
RUN cabal new-configure semantic semantic-core
RUN cabal new-build --only-dependencies

# Once the dependencies are built, copy in the rest of the code and compile
# semantic itself.
COPY . /build
RUN cabal new-build semantic:exe:semantic
# Copy in and build the entire project
COPY . .
RUN cabal new-build --flags="release" semantic:exe:semantic

# A fake `install` target until we can get `cabal new-install` to work
RUN cp $(find dist-newstyle -name semantic -type f -perm -u=x) /usr/local/bin/semantic
RUN cp $(find dist-newstyle/build/x86_64-linux -name semantic -type f -perm -u=x) /usr/local/bin/semantic

# Create a fresh image containing only the compiled CLI program, so that the
# image isn't bulked up by all of the extra build state.
Expand Down
26 changes: 26 additions & 0 deletions script/publish
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#/ Usage: script/publish
#/
#/ Build a docker image of the semantic CLI and publish to the GitHub Package Registry

set -e
cd $(dirname "$0")/..

VERSION="0.6.0"
BUILD_SHA=$(git rev-parse HEAD 2>/dev/null)
DOCKER_IMAGE=docker.pkg.github.com/github/semantic/semantic

# Build
docker build -t $DOCKER_IMAGE .

# Make sure semantic is in the image.
docker run --rm $DOCKER_IMAGE --version

# Requires that you've logged in to the GPR (e.g. `docker login docker.pkg.github.com`)
# https://help.github.com/en/articles/configuring-docker-for-use-with-github-package-registry
docker tag $DOCKER_IMAGE $DOCKER_IMAGE:latest
docker tag $DOCKER_IMAGE $DOCKER_IMAGE:$VERSION
docker tag $DOCKER_IMAGE $DOCKER_IMAGE:sha_$BUILD_SHA
docker push $DOCKER_IMAGE:sha_$BUILD_SHA
docker push $DOCKER_IMAGE:$VERSION
docker push $DOCKER_IMAGE:latest