Skip to content

Commit

Permalink
build and publish image
Browse files Browse the repository at this point in the history
  • Loading branch information
CubicrootXYZ committed May 26, 2024
1 parent 44b70ee commit 3d9b196
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release
on:
release:
types: [published]

jobs:
# Builds the image and publishes it on docker hub
build_and_push_docker:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Build container
run: docker build --build-arg VERSION=${{ github.ref_name }} -t cubicrootxyz/trollinfo:latest .
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push image (latest)
run: docker push cubicrootxyz/remindme:latest
- name: Tag image with version
run: docker tag cubicrootxyz/remindme:latest cubicrootxyz/remindme:${{ github.event.release.tag_name }}
- name: Push image (version)
run: docker push cubicrootxyz/remindme:${{ github.event.release.tag_name }}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM golang:1.22 as builder
ARG VERSION="development"

WORKDIR /run

COPY ./ ./
RUN go mod download
RUN go build -ldflags="-w -s -X github.com/CubicrootXYZ/matrix-reminder-and-calendar-bot/cmd.Version=${VERSION}" -o /run ./cmd/remindme

FROM golang:1.22
RUN apt update && apt upgrade -y && \
apt install -y gcc && \
apt install libolm-dev npm -y
COPY --from=builder /run/remindme /run/
WORKDIR /run

CMD ["/run/remindme"]

0 comments on commit 3d9b196

Please sign in to comment.