Skip to content

Commit

Permalink
Merge branch 'Api_telechargement' of github.com:IGNF/geonetwork-ui in…
Browse files Browse the repository at this point in the history
…to Api_telechargement
  • Loading branch information
Naminoshin committed May 17, 2024
2 parents 05f183e + 5306f19 commit 3bd6864
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 11 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/docker-image-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: docker-datahub-download

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: ['Api_telechargement']
# Publish semver tags as releases.
tags: ['v*.*.*']

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}_datahub_download

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image dathub
id: build-and-push-frontend
uses: docker/build-push-action@v3
with:
context: ./
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
29 changes: 18 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
### STAGE 1: Définir le répertoire de travail ###
FROM docker.io/node:lts-alpine
WORKDIR /usr/src/app
COPY package.json ./
RUN npm install
FROM node:16.13.0-alpine AS builder

WORKDIR /app

COPY . .
RUN npm run build

### STAGE 2: ###
FROM docker.io/nginx:1.17.1-alpine
COPY nginx.conf /etc/nginx/conf.d/nginx.conf
COPY --from=build /usr/src/app/dist/geonetwork-ui-image /usr/share/nginx/html
EXPOSE 80
RUN npm install

RUN npx nx build app/datahub

FROM nginx:stable-alpine

WORKDIR /usr/share/nginx/htmlRUN rm -rf ./*

COPY --from=builder /app/apps/datahub /usr/share/nginx/html


RUN sed -i '10i \\ttry_files $uri $uri/ /index.html;' /etc/nginx/conf.d/default.conf

ENTRYPOINT ["nginx", "-g", "daemon off;"]

0 comments on commit 3bd6864

Please sign in to comment.