Switch to arm64 and build Docker container
continuous-integration/drone/push Build is passing Details

This commit is contained in:
nemunaire 2023-06-02 13:59:25 +02:00
parent 1ca12a3f0f
commit 1bcfe038f2
2 changed files with 22 additions and 20 deletions

View File

@ -5,7 +5,7 @@ name: build-arm
platform:
os: linux
arch: arm
arch: arm64
workspace:
base: /go
@ -23,8 +23,6 @@ steps:
- ln idfm-api-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} deploy/idfm-api
environment:
CGO_ENABLED: 0
GOARCH: arm
GOARM: 5
when:
event:
exclude:
@ -41,29 +39,20 @@ steps:
- ln idfm-api-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} deploy/idfm-api
environment:
CGO_ENABLED: 0
GOARCH: arm
GOARM: 5
when:
event:
- tag
- name: deploy
image: appleboy/drone-scp:linux-arm
- name: docker
image: plugins/docker
settings:
tar_tmp_path: /tmp/
host: ratp.p0m.fr
target: /usr/local/bin/ratp
source: deploy/idfm-api
strip_components: 1
registry: registry.nemunai.re
repo: registry.nemunai.re/idfm-api
auto_tag: true
username:
from_secret: ssh_username
key:
from_secret: deploy_key
port:
from_secret: ssh_port
when:
branch:
- master
from_secret: docker_username
password:
from_secret: docker_password
trigger:
event:

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM golang:1-alpine AS build
COPY . /go/src/git.nemunai.re/idfm-api
WORKDIR /go/src/git.nemunai.re/idfm-api
RUN go get -v && go generate -v && go build -v -ldflags="-s -w"
FROM alpine:3.18
EXPOSE 8080
CMD ["/srv/idfm-api"]
COPY --from=build /go/src/git.nemunai.re/idfm-api/idfm-api /srv/idfm-api