#13 action for automatically building and pushing docker images
Co-authored-by: Tim <timwundenberg@outlook.de> Reviewed-on: tim/me-fit#20
This commit is contained in:
15
.gitea/workflows/build.yaml
Normal file
15
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
name: Build Docker Image
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Explore-Gitea-Actions:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- run: docker build api/
|
||||||
|
- run: |
|
||||||
|
docker build \
|
||||||
|
--build-arg="PUBLIC_BASE_API_URL=${{ vars.PUBLIC_BASE_API_URL }}" \
|
||||||
|
view/
|
||||||
26
.gitea/workflows/buildAndPush.yaml
Normal file
26
.gitea/workflows/buildAndPush.yaml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Build and Push Docker Image
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Explore-Gitea-Actions:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- run: docker login git.wundenbergs.de -u tim -p ${{ secrets.DOCKER_GITEA_TOKEN }}
|
||||||
|
- run: |
|
||||||
|
docker build \
|
||||||
|
-t git.wundenbergs.de/tim/me-fit/api:latest \
|
||||||
|
-t git.wundenbergs.de/tim/me-fit/api:$GITHUB_SHA \
|
||||||
|
api/
|
||||||
|
- run: docker push git.wundenbergs.de/tim/me-fit/api:latest
|
||||||
|
- run: |
|
||||||
|
docker build \
|
||||||
|
--build-arg="PUBLIC_BASE_API_URL=${{ vars.PUBLIC_BASE_API_URL }}" \
|
||||||
|
-t git.wundenbergs.de/tim/me-fit/view:latest \
|
||||||
|
-t git.wundenbergs.de/tim/me-fit/view:$GITHUB_SHA \
|
||||||
|
view/
|
||||||
|
- run: docker push git.wundenbergs.de/tim/me-fit/view:latest
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.22 as builder
|
FROM golang:1.22 AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY go.mod go.sum main.go ./
|
COPY go.mod go.sum main.go ./
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
FROM node:20 AS build
|
FROM node:20 AS build
|
||||||
|
ARG PUBLIC_BASE_API_URL=
|
||||||
|
|
||||||
WORKDIR .
|
WORKDIR /app
|
||||||
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
RUN npm install && npm run build
|
RUN npm install && npm run build
|
||||||
|
|
||||||
FROM nginx:1.27.0-alpine
|
FROM nginx:1.27.0-alpine
|
||||||
COPY --from=build /build /usr/share/nginx/html
|
COPY --from=build /app/build /usr/share/nginx/html
|
||||||
|
|||||||
Reference in New Issue
Block a user