Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Dockerfile #1036

Merged
merged 13 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,11 @@ updates:
- 4.19.0
- 4.20.0
- 4.21.0

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "00:00"
timezone: Europe/London
38 changes: 38 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow file builds and pushes the Dockerfile
# located in this repo, to the SCD harbor Docker registry.
# It uses a harbor robot account, whose credentials are
# stored as secrets in this repo.

name: Build & Push Docker Image

on:
workflow_dispatch:
push:
branches:
- k8s-deployment

jobs:
push_to_registry:
name: Push Docker image to Harbor
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Harbor
uses: docker/login-action@v1
with:
registry: harbor.stfc.ac.uk/datagateway
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: harbor.stfc.ac.uk/datagateway/scigateway
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Multipart build dockerfile to build and serve scigateway

FROM node:16.14-alpine3.15 as build
WORKDIR /scigateway
ENV PATH /scigateway/node_modules/.bin:$PATH

# Set Yarn version
# TODO - Use Yarn 2 when project is upgraded
RUN yarn set version 1.22

# Install dependancies
# TODO: use yarn install --production:
# https://github.com/ral-facilities/scigateway/issues/1025
COPY . .
RUN yarn install
RUN yarn build

# Put the output of the build into an apache server
FROM httpd:2.4-alpine3.15
WORKDIR /usr/local/apache2/htdocs
COPY --from=build /scigateway/build/. .