Skip to content

Commit

Permalink
Replace earthly with dockerfile (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
applejag authored Dec 11, 2023
1 parent 695778d commit 31aae0b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 48 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ build
# Files not needed during builds
.dockerignore
.gitignore
Dockerfile
Earthfile
**/*.md
**/*.license
Expand Down
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2023 Risk.Ident GmbH <[email protected]>
#
# SPDX-License-Identifier: CC0-1.0

FROM golang:1.21.5-alpine AS build
WORKDIR /jelease
COPY go.mod go.sum ./
RUN go mod download

ARG VERSION=latest
COPY . .
RUN go test -v ./... \
&& go build \
-ldflags "-X github.com/RiskIdent/jelease/cmd.appVersion=$VERSION" \
-o build/jelease main.go

FROM alpine
RUN apk add --no-cache ca-certificates git
COPY --from=build /jelease/build/jelease /usr/local/bin/
CMD ["jelease", "serve"]
USER 10000
LABEL org.opencontainers.image.source=https://github.com/RiskIdent/jelease
LABEL org.opencontainers.image.description="Automatically create software update PRs and Jira tickets using newreleases.io webhooks."
LABEL org.opencontainers.image.licenses=GPL-3.0-or-later
40 changes: 0 additions & 40 deletions Earthfile

This file was deleted.

15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,15 @@ config file:

## Building the application and docker image

The application uses [earthly](https://earthly.dev/get-earthly) for building
and pushing a docker image.

After installing earthly, the image can be built by running

```bash
earhtly +docker
VERSION=v0.4.1
podman build -t ghcr.io/riskident/jelease:${VERSION} --build-arg VERSION=${VERSION}
podman tag ghcr.io/riskident/jelease:{${VERSION},latest}
# if you want to push a new image version
earhtly --push +docker --VERSION=v0.4.1
podman login ghcr.io
podman push ghcr.io/riskident/jelease:${VERSION}
podman push ghcr.io/riskident/jelease:latest
```

You can also persist build flags in a `.env` file, e.g:
Expand Down

0 comments on commit 31aae0b

Please sign in to comment.