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

Upgrade packages, change tag/target syntax (#23) #27

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Change tag and target syntax (#23)
Previously, each image was tagged like the following:

* `ghc-musl:v24-ghc924`

With this commit, each image is now tagged like the following:

* `ghc-musl:ghc9.2.4-alpine3.16.1-20220730`
* `ghc-musl:ghc9.2.4-alpine3.16.1`
* `ghc-musl:ghc9.2.4`

This allows users to specify image names according to their needs.  An
image tagged with the GHC version, Alpine version, and (UTC) build date
never changes.  An image tagged with just the GHC version and Alpine
version may be updated to include minor/security package releases, but
the fixed Alpine version means that major upgrades should not break
builds.  An image tagged with just the GHC version may be updated to
include new package releases, both major and minor.

The Earthly targets are renamed to match the new tags.  For example,
previous target `ghc924` is now named `ghc9.2.4`.

Note that updating the GHC-only tag should be done with caution, so that
it always points to an image using the latest (supported) Alpine
version.  To facilitate this, the `image` target has a `TAG_GHC`
argument that defaults to `0` so that the GHC-only tag is not saved by
default.  This argument should be set to `1` only when updating the
image using the latest (supported) Alpine version.  The following
command is an example of using this argument when building locally:

```
$ earthly --allow-privileged --build-arg TAG_GHC=1 +ghc9.2.4
```

The `ALPINE_VERSION` variable is still set to the latest (supported)
Alpine version, *not* set to `latest`.  Users who would like to use the
`latest` image are still able to do so by specifying it in a build
argument.
  • Loading branch information
TravisCardwell committed Jul 31, 2022
commit 0cb9841e066806a6ee27ff22ce4beab330d8fab3
46 changes: 26 additions & 20 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ VERSION 0.6
ARG ALPINE_VERSION=3.16.1
FROM alpine:$ALPINE_VERSION

ARG GHC_MUSL_VERSION=24
ARG BASE_TAG=utdemir/ghc-musl:v${GHC_MUSL_VERSION}-
ARG DATE=$(date --utc +%Y%m%d)

ARG IMAGE_NAME=utdemir/ghc-musl

base-system:
FROM alpine:$ALPINE_VERSION
Expand Down Expand Up @@ -78,40 +79,45 @@ image:
FROM +ghc
ARG TEST_CABAL=1
ARG TEST_STACK=1
ARG --required TAG
ARG --required GHC
ARG TAG_GHC=0
IF [ "$TEST_CABAL" = "1" ]
BUILD +test-cabal
END
IF [ "$TEST_STACK" = "1" ]
BUILD +test-stack
END
SAVE IMAGE --push "$TAG"
IF [ "$TAG_GHC" = "1" ]
SAVE IMAGE --push "${IMAGE_NAME}:ghc${GHC}"
END
SAVE IMAGE --push "${IMAGE_NAME}:ghc${GHC}-alpine${ALPINE_VERSION}"
SAVE IMAGE --push "${IMAGE_NAME}:ghc${GHC}-alpine${ALPINE_VERSION}-${DATE}"

ghc924:
BUILD +image --GHC=9.2.4 --TAG=${BASE_TAG}ghc924
ghc9.2.4:
BUILD +image --GHC=9.2.4

ghc902:
BUILD +image --GHC=9.0.2 --TAG=${BASE_TAG}ghc902
ghc9.0.2:
BUILD +image --GHC=9.0.2

ghc8107:
BUILD +image --GHC=8.10.7 --TAG=${BASE_TAG}ghc8107
ghc8.10.7:
BUILD +image --GHC=8.10.7

ghc884:
BUILD +image --GHC=8.8.4 --TAG=${BASE_TAG}ghc884
ghc8.8.4:
BUILD +image --GHC=8.8.4

readme:
RUN apk add bash gettext
COPY ./update-readme.sh .
RUN ./update-readme.sh \
"${BASE_TAG}ghc924" \
"${BASE_TAG}ghc902" \
"${BASE_TAG}ghc8107" \
"${BASE_TAG}ghc884"
"${IMAGE_NAME}:ghc9.2.4-alpine${ALPINE_VERSION}-${DATE}" \
"${IMAGE_NAME}:ghc9.0.2-alpine${ALPINE_VERSION}-${DATE}" \
"${IMAGE_NAME}:ghc8.10.7-alpine${ALPINE_VERSION}-${DATE}" \
"${IMAGE_NAME}:ghc8.8.4-alpine${ALPINE_VERSION}-${DATE}"
SAVE ARTIFACT README.md

all:
BUILD +ghc924
BUILD +ghc902
BUILD +ghc8107
BUILD +ghc884
BUILD +ghc9.2.4
BUILD +ghc9.0.2
BUILD +ghc8.10.7
BUILD +ghc8.8.4
BUILD +readme