Skip to content

Commit 6a46e74

Browse files
init
0 parents  commit 6a46e74

File tree

15 files changed

+848
-0
lines changed

15 files changed

+848
-0
lines changed

.github/workflows/ci-cd.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Install dependencies
17+
run: lein deps
18+
19+
- name: Run tests
20+
run: lein test
21+
22+
- name: Build uberjar
23+
run: lein uberjar
24+
25+
- name: Upload uberjar artifact
26+
uses: actions/upload-artifact@v2
27+
with:
28+
name: walue-uberjar
29+
path: target/uberjar/walue-*-standalone.jar
30+
31+
docker-build:
32+
needs: build-and-test
33+
runs-on: ubuntu-latest
34+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
35+
36+
steps:
37+
- uses: actions/checkout@v2
38+
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v1
41+
42+
- name: Login to DockerHub
43+
uses: docker/login-action@v1
44+
with:
45+
username: ${{ secrets.DOCKERHUB_USERNAME }}
46+
password: ${{ secrets.DOCKERHUB_TOKEN }}
47+
48+
- name: Build and push
49+
uses: docker/build-push-action@v2
50+
with:
51+
context: .
52+
push: true
53+
tags: |
54+
yourusername/walue:latest
55+
yourusername/walue:${{ github.sha }}

.lein-failures

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM clojure:openjdk-17-tools-deps-slim-buster AS builder
2+
3+
WORKDIR /app
4+
5+
# Copy the project files
6+
COPY project.clj /app/
7+
COPY src /app/src/
8+
9+
# Download dependencies and build the uberjar
10+
RUN lein deps
11+
RUN lein uberjar
12+
13+
# Create a minimal runtime image
14+
FROM openjdk:17-slim-buster
15+
16+
WORKDIR /app
17+
18+
# Copy the uberjar from the builder stage
19+
COPY --from=builder /app/target/uberjar/walue-*-standalone.jar /app/walue.jar
20+
21+
# Expose the application port
22+
EXPOSE 8080
23+
24+
# Set the entrypoint to run the application
25+
ENTRYPOINT ["java", "-jar", "/app/walue.jar"]

0 commit comments

Comments
 (0)