Merge pull request #68 from ProjectSegfault/docker

docker
This commit is contained in:
Akis 2022-08-31 14:10:28 +03:00 committed by GitHub
commit 96841f3577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 44 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
node_modules

29
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Docker
on:
push:
branches:
- 'master'
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: projectsegfault/website:latest

View File

@ -1,44 +0,0 @@
pipeline:
build:
when:
event: [push, pull_request]
image: node:current-bullseye-slim
commands:
- npm install
- npm run build
- pwd
- mv build/ ../
- rm -rf *
- mv ../build/* .
push:
when:
event: [push]
image: appleboy/drone-git-push
settings:
branch: build
remote: git@github.com:ProjectSegfault/website.git
force: true
commit: true
commit_message: Successfully built the page.
ssh_key:
from_secret: ssh_key_git
update:
when:
event: [push]
image: appleboy/drone-ssh
settings:
host:
- projectsegfau.lt
username: gitea
key:
from_secret: ssh_key
port: 6665
command_timeout: 1m
script:
- cd /var/www/
- rm -rf html
- git clone -b build https://github.com/ProjectSegfault/website.git html
- cd html
# I HATE GIT AND HOW THEY FORCE THIS
# todo: do the funny pull but find a way to accept the changes.
branches: main

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM node:16 AS build
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . ./
RUN npm run build
FROM nginx:1.23-alpine
COPY --from=build /app/build /usr/share/nginx/html
EXPOSE 80