Skip to content

Commit 921813b

Browse files
stifskereSergioRibera
authored andcommitted
chore: trye
1 parent ce3a29d commit 921813b

File tree

2 files changed

+23
-29
lines changed

2 files changed

+23
-29
lines changed

.github/workflows/docker.yml

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
name: Create and publish a Docker image
1+
name: Create and Publish a Docker Image
22

33
on:
44
push:
5-
tags:
6-
- "**"
75
branches:
86
- main
97
workflow_dispatch:
10-
inputs:
11-
tag:
12-
description: ""
13-
required: true
14-
type: string
158

169
env:
1710
REGISTRY: ghcr.io
@@ -24,33 +17,27 @@ jobs:
2417
packages: write
2518
attestations: write
2619
id-token: write
20+
2721
steps:
2822
- name: Checkout repository
2923
uses: actions/checkout@v4
30-
- name: downcase REPO
31-
run: |
32-
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
33-
- name: Login to the Container registry
34-
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
24+
25+
- name: Set IMAGE_NAME
26+
run: echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
27+
28+
- name: Login to the Container Registry
29+
uses: docker/login-action@v2
3530
with:
3631
registry: ${{ env.REGISTRY }}
3732
username: ${{ github.actor }}
3833
password: ${{ secrets.GITHUB_TOKEN }}
39-
- name: Extract metadata (tags, labels) for Docker
40-
id: meta
41-
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
42-
with:
43-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44-
45-
- name: Push image to DO Container Registry
46-
env:
47-
LITCRYPT_ENCRYPT_KEY: ${{ secrets.LITCRYPT_ENCRYPT_KEY }}
48-
STRIPE_SECRET: ${{ secrets.STRIPE_SECRET }}
49-
run: docker compose build --push
5034

51-
- name: Push Docker image
35+
- name: Build and Push Docker Image
5236
run: |
53-
IMG_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
54-
IMAGE_TAG=${{ inputs.tag || steps.meta.outputs.labels.org.opencontainers.image.version || 'latest' }}
55-
docker tag ${{ env.IMAGE_NAME }}:$IMAGE_TAG $IMG_NAME:$IMAGE_TAG
37+
IMAGE_TAG=latest
38+
IMG_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+
echo "Building and pushing $IMG_NAME:$IMAGE_TAG"
40+
docker build --build-arg "LITCRYPT_ENCRYPT_KEY=${{ secrets.LITCRYPT_ENCRYPT_KEY }}" \
41+
--build-arg "STRIPE_SECRET=${{ secrets.STRIPE_SECRET }}" \
42+
-t $IMG_NAME:$IMAGE_TAG .
5643
docker push $IMG_NAME:$IMAGE_TAG

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
# Rust builder
22
FROM rust:1.82-slim-bullseye AS backend-builder
33

44
RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev pkg-config
@@ -20,6 +20,7 @@ ENV DATABASE_URL=$DATABASE_URL
2020

2121
RUN SQLX_OFFLINE=true cargo build --release
2222

23+
# front builder
2324
FROM denoland/deno:2.1.1 AS frontend-builder
2425

2526
WORKDIR /build
@@ -29,8 +30,14 @@ COPY frontend .
2930
RUN deno install
3031
RUN deno task build
3132

33+
#
34+
# Runtime
35+
#
3236
FROM nginx:1-bullseye
3337

38+
ARG DATABASE_URL
39+
ENV DATABASE_URL=$DATABASE_URL
40+
3441
RUN apt-get update && apt-get install -y \
3542
libssl-dev \
3643
libc6 \

0 commit comments

Comments
 (0)