feat: Added actions to build and upload docker image
Some checks failed
Docker Build / build (push) Failing after 1m2s
Some checks failed
Docker Build / build (push) Failing after 1m2s
This commit is contained in:
parent
ef6275a072
commit
d940aa2169
28
.gitea/workflows/docker-build.yml
Normal file
28
.gitea/workflows/docker-build.yml
Normal file
@ -0,0 +1,28 @@
|
||||
name: Docker Build
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Container Registry
|
||||
run: |
|
||||
docker login git.ambeles.nl \
|
||||
-u ${{ secrets.REGISTRY_USERNAME }} \
|
||||
-p ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build \
|
||||
-t git.ambeles.nl/bedroomghost/gpx-viewer:${{ github.sha }} .
|
||||
|
||||
- name: Push Docker Image
|
||||
run: |
|
||||
docker tag git.ambeles.nl/bedroomghost/gpx-viewer:${{ github.sha }} git.ambeles.nl/bedroomghost/gpx-viewer:latest
|
||||
docker push git.ambeles.nl/bedroomghost/gpx-viewer:${{ github.sha }}
|
||||
docker push git.ambeles.nl/bedroomghost/gpx-viewer:latest
|
||||
|
||||
36
Dockerfile
Normal file
36
Dockerfile
Normal file
@ -0,0 +1,36 @@
|
||||
# Build stage for gpx library
|
||||
FROM node:20-alpine AS gpx-builder
|
||||
WORKDIR /app/gpx
|
||||
COPY gpx/package*.json ./
|
||||
RUN npm install
|
||||
COPY gpx/ ./
|
||||
RUN npm run build
|
||||
|
||||
# Build stage for website
|
||||
FROM node:20-alpine AS website-builder
|
||||
WORKDIR /app/website
|
||||
COPY website/package*.json ./
|
||||
RUN npm install
|
||||
COPY website/ ./
|
||||
COPY --from=gpx-builder /app/gpx/dist /app/gpx/dist
|
||||
# RUN npm link /app/gpx
|
||||
|
||||
ENV PUBLIC_MAPBOX_TOKEN="pk"
|
||||
RUN npm run build
|
||||
|
||||
FROM node:20-alpine
|
||||
WORKDIR /app
|
||||
COPY --from=website-builder /app/website/package*.json ./
|
||||
COPY --from=website-builder /app/website/build ./build
|
||||
COPY --from=website-builder /app/website/node_modules ./node_modules
|
||||
COPY --from=website-builder /app/website/build/index.html ./build/index.html.template
|
||||
|
||||
RUN echo '#!/bin/sh\ncat ./build/index.html.template | sed "s/pk.dummy_token_for_build/$PUBLIC_MAPBOX_TOKEN/g" > ./build/index.html\nexec node build' > ./start.sh && \
|
||||
chmod +x ./start.sh
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PUBLIC_MAPBOX_TOKEN=""
|
||||
|
||||
CMD ["./start.sh"]
|
||||
Loading…
x
Reference in New Issue
Block a user