Skip to content

Commit d3e1136

Browse files
committed
simulator CI
1 parent 832f215 commit d3e1136

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release Simulator
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
paths:
8+
- "simulator/**"
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
REGISTRY: ghcr.io
16+
GITHUB_REPO: ${{ github.repository }}
17+
18+
jobs:
19+
docker:
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
runs-on: ubuntu-20.04
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.GITHUB_REPO }}-simulator
40+
tags: |
41+
type=raw,value=latest
42+
type=raw,value=stable,enable=${{ github.event_name == 'release' }}
43+
type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }}
44+
type=sha,priority=250,enable=${{ github.event_name == 'workflow_dispatch' }}
45+
46+
- name: Build and push Docker image
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
push: true
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}

simulator/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ RUN cd /temp && bun install --frozen-lockfile --production
1414
# copy production dependencies and source code into final image
1515
FROM base AS release
1616
COPY --from=install /temp/node_modules node_modules
17-
COPY src src
17+
COPY . .
1818

1919
# run the app
2020
USER bun
2121
EXPOSE 3000/tcp
22-
ENTRYPOINT [ "bun", "run", "src/app.ts" ]
22+
ENTRYPOINT [ "bun", "run", "app.ts" ]

simulator/rabbitmq.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import amqplib from "amqplib";
22

33
const EXCHANGE = "exchange";
44

5-
const connection = await amqplib.connect("amqp://localhost:5672");
5+
const url = process.env.RABBITMQ_URL || "amqp://localhost:5672";
6+
const connection = await amqplib.connect(url);
67

78
const channel = await connection.createChannel();
89

0 commit comments

Comments
 (0)