diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 58f47ea..0000000 --- a/Dockerfile +++ /dev/null @@ -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" ] diff --git a/Taskfile.yml b/Taskfile.yml index c2da11a..119ff53 100644 --- a/Taskfile.yml +++ b/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 ] diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 0000000..cb3daf6 --- /dev/null +++ b/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" ] diff --git a/.dockerignore b/build/Dockerfile.dockerignore similarity index 80% rename from .dockerignore rename to build/Dockerfile.dockerignore index c522ee9..9cf144e 100644 --- a/.dockerignore +++ b/build/Dockerfile.dockerignore @@ -6,4 +6,4 @@ node_modules/ .gitignore -run-local.sh \ No newline at end of file +run-local.sh