Switch to arm64 and build Docker container
All checks were successful
continuous-integration/drone/push Build is passing

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