Skip to content

Commit

Permalink
fix docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
macielti committed Sep 28, 2024
1 parent d8f4fdf commit ee5c9ab
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 15 deletions.
47 changes: 35 additions & 12 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,40 @@ on:
branches: [ main ]

jobs:
build:
name: Build an Push Docker Image
docker:
permissions: write-all
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Build and Push Docker Image
run: |
VERSION=$(date +%s)
docker login docker.pkg.github.com --username macielti --password ${{ secrets.GITHUB_TOKEN }}
docker build . --tag docker.pkg.github.com/macielti/porteiro/porteiro:latest
docker push docker.pkg.github.com/macielti/porteiro/porteiro:latest
env:
CI: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/macielti/porteiro
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ${{ steps.meta.outputs.tags }}
14 changes: 12 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM clojure
FROM clojure as buildStage

LABEL stage="builder"

COPY . /usr/src/app

Expand All @@ -8,4 +10,12 @@ RUN apt-get -y update

RUN lein deps

CMD ["lein", "trampoline", "run"]
RUN lein uberjar

FROM amazoncorretto:22-alpine

WORKDIR /app

COPY --from=buildStage /usr/src/app/target/porteiro-0.1.0-SNAPSHOT-standalone.jar /app/porteiro.jar

CMD ["java", "-jar", "porteiro.jar"]
8 changes: 7 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
(defproject porteiro "0.1.0-SNAPSHOT"

:description "A microservice for users and authentication management"

:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}

Expand Down Expand Up @@ -31,10 +33,14 @@

:injections [(require 'hashp.core)]

:resource-paths ["resources"]
:resource-paths ["resources" "test/resources/"]

:repl-options {:init-ns porteiro.v2.components}

:test-paths ["test/unit" "test/integration" "test/helpers"]

:src-dirs ["src"]

:aot :all

:main porteiro.v2.components/start-system!)

0 comments on commit ee5c9ab

Please sign in to comment.