Skip to content

Commit d259550

Browse files
authored
Merge pull request #1 from Dpbm/docker
Docker
2 parents 24528e9 + 1ec1582 commit d259550

File tree

6 files changed

+109
-0
lines changed

6 files changed

+109
-0
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
*md
3+
assets
4+
docs
5+
*git*
6+
.tool-versions

.github/workflows/dockerhub.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Docker image
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
7+
env:
8+
NAMESPACE: ${{ secrets.DOCKERHUB_NAMESPACE }}
9+
IMAGE_NAME: ${{ github.event.repository.name }}
10+
11+
jobs:
12+
push_to_registry:
13+
name: Push Docker image to Docker Hub
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out the repo
17+
uses: actions/checkout@v4
18+
19+
- name: Log in to Docker Hub
20+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
21+
with:
22+
username: ${{ secrets.DOCKER_USERNAME }}
23+
password: ${{ secrets.DOCKER_PASSWORD }}
24+
25+
- name: Extract metadata (tags, labels) for Docker
26+
id: meta
27+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
28+
with:
29+
images: ${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}
30+
31+
- name: Build and push Docker image
32+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
33+
with:
34+
context: .
35+
file: ./Dockerfile
36+
push: true
37+
tags: ${{ steps.meta.outputs.tags }}
38+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/ghrc.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
build-and-push-image:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Log in to the Container registry
22+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
23+
with:
24+
registry: ${{ env.REGISTRY }}
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.TOKEN }}
27+
28+
- name: Extract metadata (tags, labels) for Docker
29+
id: meta
30+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
31+
with:
32+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
33+
34+
- name: Build and push Docker image
35+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
36+
with:
37+
context: .
38+
push: true
39+
tags: ${{ steps.meta.outputs.tags }}
40+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#syntax=docker/dockerfile:1
2+
FROM node:18-alpine
3+
LABEL org.opencontainers.image.source=https://github.com/Dpbm/coderchallenge-dsin-2023
4+
ENV LANG pt_BR.UTF-8
5+
WORKDIR /app
6+
COPY package.json pnpm-lock.yaml /app/
7+
RUN npm install -g pnpm && pnpm install
8+
COPY . /app/
9+
CMD [ "pnpm", "start" ]

docker-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: '3'
2+
services:
3+
app:
4+
build: .

readme.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ após tudo instalado, execute o projeto com:
5151
npm run start
5252
```
5353

54+
Se preferir você pode usar a versão em docker rodando:
55+
56+
```bash
57+
docker run -it dpbm32/coderchallenge-dsin-2023
58+
```
59+
60+
ou
61+
62+
```bash
63+
docker-compose run app
64+
```
65+
5466
`OBS: deixe o terminal em tela cheia para melhor experiência`.
5567

5668
## navegando pelo software

0 commit comments

Comments
 (0)