Browse Source

add build

migrate-to-golang
Dennis Jekubczyk 3 years ago
parent
commit
fab90936cd
4 changed files with 22 additions and 9 deletions
  1. +0
    -7
      Dockerfile
  2. +6
    -1
      Taskfile.yml
  3. +15
    -0
      build/Dockerfile
  4. +1
    -1
      build/Dockerfile.dockerignore

+ 0
- 7
Dockerfile

@ -1,7 +0,0 @@
FROM node:lts-alpine
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
CMD [ "/app/docker-entrypoint.sh" ]

+ 6
- 1
Taskfile.yml

@ -16,13 +16,18 @@ tasks:
cmds:
- task: lint
- task: test
- task: build
test:
cmds: [ go test ./... ]
lint:
desc: lint app
desc: lint
cmds: [ third_party/golangci-lint/golangci-lint run ]
build:
desc: build
cmds: [ docker image build -t jaedle/mirror-to-gitea:development -f build/Dockerfile . ]
default:
cmds: [ task: world ]

+ 15
- 0
build/Dockerfile

@ -0,0 +1,15 @@
FROM golang:1.16-alpine as builder
WORKDIR /app
ADD . ./
RUN ls -al && go build -o main main.go
FROM scratch as runtime
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
WORKDIR /app
COPY --from=builder /app/main main
CMD [ "/app/main" ]

.dockerignore → build/Dockerfile.dockerignore

@ -6,4 +6,4 @@ node_modules/
.gitignore
run-local.sh
run-local.sh

Loading…
Cancel
Save