Skip to content

Commit

Permalink
v0.2
Browse files Browse the repository at this point in the history
add auto docker image build
  • Loading branch information
SIPC committed Nov 17, 2024
1 parent cbc6bc4 commit 2c72f0b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Docker Build

on:
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/fanyi-node:latest
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:18-alpine

COPY ./lib /home/app/lib
COPY ./tool /home/app/tool
COPY package.json /home/app
COPY router.js /home/app
COPY server.js /home/app

RUN cd /home/app && npm install

WORKDIR /home/app

EXPOSE 3000
CMD ["node", "server.js"]
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "Fanyi-Node",
"name": "fanyi-node",
"version": "1.0.0",
"description": "",
"main": "index.js",
"main": "server.js",
"type": "module",
"scripts": {
"test": "node index.js"
"test": "node server.js"
},
"keywords": [],
"author": "",
Expand Down

0 comments on commit 2c72f0b

Please sign in to comment.