docker alpine: use the latest stable docker tag for both run and build env

so we don't need to update our Dockerfile each time a new alpine or golang
version is released
This commit is contained in:
Nicola Murino 2019-09-09 12:58:07 +02:00
parent f4507aeec2
commit e79f7010b4
2 changed files with 4 additions and 3 deletions

View file

@ -1,4 +1,4 @@
FROM golang:1.13-alpine3.10 as builder
FROM golang:alpine as builder
RUN apk add --no-cache git gcc g++ ca-certificates \
&& go get -d github.com/drakkan/sftpgo
@ -7,7 +7,7 @@ WORKDIR /go/src/github.com/drakkan/sftpgo
#RUN git checkout `git rev-list --tags --max-count=1`
RUN go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/utils.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/utils.date=`date -u +%FT%TZ`" -o /go/bin/sftpgo
FROM alpine:3.10
FROM alpine:latest
RUN apk add --no-cache ca-certificates su-exec \
&& mkdir -p /data /etc/sftpgo /srv/sftpgo/config

View file

@ -327,8 +327,9 @@ func loginUser(user dataprovider.User, loginType string) (*ssh.Permissions, erro
return nil, fmt.Errorf("Cannot login user with invalid home dir: %v", user.HomeDir)
}
if _, err := os.Stat(user.HomeDir); os.IsNotExist(err) {
logger.Debug(logSender, "", "home directory %#v for user %v does not exist, try to create", user.HomeDir, user.Username)
err := os.MkdirAll(user.HomeDir, 0777)
logger.Debug(logSender, "", "home directory %#v for user %v does not exist, try to create, mkdir error: %v",
user.HomeDir, user.Username, err)
if err == nil {
utils.SetPathPermissions(user.HomeDir, user.GetUID(), user.GetGID())
}