Skip to content

Commit 027a0f4

Browse files
committed
👷 Adding CI/CD
1 parent cd55528 commit 027a0f4

File tree

2 files changed

+54
-5
lines changed

2 files changed

+54
-5
lines changed

.github/workflows/deploy.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
name: Create and publish a Docker image
7+
8+
on:
9+
push:
10+
branches: ['release']
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
IMAGE_NAME: ${{ github.repository }}
15+
16+
jobs:
17+
build-and-push-image:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
27+
- name: Log in to the Container registry
28+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Extract metadata (tags, labels) for Docker
35+
id: meta
36+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
37+
with:
38+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}{% raw %}
39+
40+
- name: Build and push Docker image
41+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
42+
with:
43+
context: .
44+
push: true
45+
tags: {% raw %}${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
FROM node:13-alpine
1+
FROM node:13-alpine AS builder
22

33
WORKDIR /app
44

55
RUN npm install -g --unsafe-perm create-elm-app
66

7-
EXPOSE 3000
7+
COPY . .
88

9-
ENTRYPOINT [ "/usr/local/bin/elm-app" ]
9+
RUN /usr/local/bin/elm-app build
1010

11-
# to compile docker run --rm -v $PWD:/app elm-compiler
12-
CMD [ "build" ]
11+
FROM nginx
12+
13+
COPY --from=builder /app/build /usr/share/nginx/html/
14+
15+
EXPOSE 80

0 commit comments

Comments
 (0)